From 87b748f2f0dab97497e24ad30cc337d0ab3792c6 Mon Sep 17 00:00:00 2001 From: Jack Rosenthal Date: Wed, 16 Mar 2022 13:41:05 -0600 Subject: zephyr: Pop a directory from the brya project path We aren't nesting the directory structure like ${PROGRAM}/${PROJECT} anymore. BUG=none BRANCH=none TEST=zmake build brya Signed-off-by: Jack Rosenthal Change-Id: I44da0d7d43c097cd05e1e003926d302d0c3beb8b Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/ec/+/3530959 Reviewed-by: Jeremy Bettis --- zephyr/projects/brya/BUILD.py | 22 ++ zephyr/projects/brya/CMakeLists.txt | 39 +++ zephyr/projects/brya/battery.dts | 15 ++ zephyr/projects/brya/battery_present.c | 21 ++ zephyr/projects/brya/bb_retimer.dts | 24 ++ zephyr/projects/brya/brya/BUILD.py | 22 -- zephyr/projects/brya/brya/CMakeLists.txt | 39 --- zephyr/projects/brya/brya/battery.dts | 15 -- zephyr/projects/brya/brya/battery_present.c | 21 -- zephyr/projects/brya/brya/bb_retimer.dts | 24 -- zephyr/projects/brya/brya/cbi_eeprom.dts | 16 -- zephyr/projects/brya/brya/fan.dts | 35 --- zephyr/projects/brya/brya/gpio.dts | 364 --------------------------- zephyr/projects/brya/brya/include/gpio_map.h | 16 -- zephyr/projects/brya/brya/interrupts.dts | 150 ----------- zephyr/projects/brya/brya/kblight_hooks.c | 67 ----- zephyr/projects/brya/brya/keyboard.dts | 16 -- zephyr/projects/brya/brya/motionsense.dts | 264 ------------------- zephyr/projects/brya/brya/prj.conf | 208 --------------- zephyr/projects/brya/brya/pwm_leds.dts | 72 ------ zephyr/projects/brya/brya/usbc.dts | 52 ---- zephyr/projects/brya/cbi_eeprom.dts | 16 ++ zephyr/projects/brya/fan.dts | 35 +++ zephyr/projects/brya/gpio.dts | 364 +++++++++++++++++++++++++++ zephyr/projects/brya/include/gpio_map.h | 16 ++ zephyr/projects/brya/interrupts.dts | 150 +++++++++++ zephyr/projects/brya/kblight_hooks.c | 67 +++++ zephyr/projects/brya/keyboard.dts | 16 ++ zephyr/projects/brya/motionsense.dts | 264 +++++++++++++++++++ zephyr/projects/brya/prj.conf | 208 +++++++++++++++ zephyr/projects/brya/pwm_leds.dts | 72 ++++++ zephyr/projects/brya/usbc.dts | 52 ++++ 32 files changed, 1381 insertions(+), 1381 deletions(-) create mode 100644 zephyr/projects/brya/BUILD.py create mode 100644 zephyr/projects/brya/CMakeLists.txt create mode 100644 zephyr/projects/brya/battery.dts create mode 100644 zephyr/projects/brya/battery_present.c create mode 100644 zephyr/projects/brya/bb_retimer.dts delete mode 100644 zephyr/projects/brya/brya/BUILD.py delete mode 100644 zephyr/projects/brya/brya/CMakeLists.txt delete mode 100644 zephyr/projects/brya/brya/battery.dts delete mode 100644 zephyr/projects/brya/brya/battery_present.c delete mode 100644 zephyr/projects/brya/brya/bb_retimer.dts delete mode 100644 zephyr/projects/brya/brya/cbi_eeprom.dts delete mode 100644 zephyr/projects/brya/brya/fan.dts delete mode 100644 zephyr/projects/brya/brya/gpio.dts delete mode 100644 zephyr/projects/brya/brya/include/gpio_map.h delete mode 100644 zephyr/projects/brya/brya/interrupts.dts delete mode 100644 zephyr/projects/brya/brya/kblight_hooks.c delete mode 100644 zephyr/projects/brya/brya/keyboard.dts delete mode 100644 zephyr/projects/brya/brya/motionsense.dts delete mode 100644 zephyr/projects/brya/brya/prj.conf delete mode 100644 zephyr/projects/brya/brya/pwm_leds.dts delete mode 100644 zephyr/projects/brya/brya/usbc.dts create mode 100644 zephyr/projects/brya/cbi_eeprom.dts create mode 100644 zephyr/projects/brya/fan.dts create mode 100644 zephyr/projects/brya/gpio.dts create mode 100644 zephyr/projects/brya/include/gpio_map.h create mode 100644 zephyr/projects/brya/interrupts.dts create mode 100644 zephyr/projects/brya/kblight_hooks.c create mode 100644 zephyr/projects/brya/keyboard.dts create mode 100644 zephyr/projects/brya/motionsense.dts create mode 100644 zephyr/projects/brya/prj.conf create mode 100644 zephyr/projects/brya/pwm_leds.dts create mode 100644 zephyr/projects/brya/usbc.dts diff --git a/zephyr/projects/brya/BUILD.py b/zephyr/projects/brya/BUILD.py new file mode 100644 index 0000000000..4e2a556234 --- /dev/null +++ b/zephyr/projects/brya/BUILD.py @@ -0,0 +1,22 @@ +# Copyright 2021 The Chromium OS Authors. All rights reserved. +# Use of this source code is governed by a BSD-style license that can be +# found in the LICENSE file. + +brya = register_npcx_project( + project_name="brya", + zephyr_board="brya", + dts_overlays=[ + "battery.dts", + "bb_retimer.dts", + "cbi_eeprom.dts", + "fan.dts", + "gpio.dts", + "interrupts.dts", + "keyboard.dts", + "motionsense.dts", + "pwm_leds.dts", + "usbc.dts", + ], +) + +ghost = brya.variant(project_name="ghost") diff --git a/zephyr/projects/brya/CMakeLists.txt b/zephyr/projects/brya/CMakeLists.txt new file mode 100644 index 0000000000..0cb61eb838 --- /dev/null +++ b/zephyr/projects/brya/CMakeLists.txt @@ -0,0 +1,39 @@ +# Copyright 2021 The Chromium OS Authors. All rights reserved. +# Use of this source code is governed by a BSD-style license that can be +# found in the LICENSE file. + +cmake_minimum_required(VERSION 3.13.1) + +find_package(Zephyr REQUIRED HINTS $ENV{ZEPHYR_BASE}) +project(brya) + +set(PLATFORM_EC_BOARD "${PLATFORM_EC}/board/brya" CACHE PATH + "Path to the platform/ec board directory") +set(PLATFORM_EC_BASEBOARD "${PLATFORM_EC}/baseboard/brya" CACHE PATH + "Path to the platform/ec baseboard directory") + +# Include board specific header files +zephyr_include_directories( + include + "${PLATFORM_EC}/driver/tcpm" + "${PLATFORM_EC_BASEBOARD}" + "${PLATFORM_EC_BOARD}") + +zephyr_library_sources_ifdef(CONFIG_PLATFORM_EC_BATTERY + "${PLATFORM_EC_BASEBOARD}/battery_presence.c") +zephyr_library_sources_ifdef(CONFIG_PLATFORM_EC_CBI_EEPROM + "${PLATFORM_EC_BASEBOARD}/cbi.c") +zephyr_library_sources_ifdef(CONFIG_PLATFORM_EC_PWM_KBLIGHT + "kblight_hooks.c") +zephyr_library_sources_ifdef(CONFIG_PLATFORM_EC_BATTERY + "${PLATFORM_EC_BASEBOARD}/battery_presence.c") +zephyr_library_sources_ifdef(CONFIG_PLATFORM_EC_BATTERY + "battery_present.c") +zephyr_library_sources_ifdef(CONFIG_PLATFORM_EC_USB_POWER_DELIVERY + "${PLATFORM_EC_BASEBOARD}/usb_pd_policy.c") +zephyr_library_sources_ifdef(CONFIG_PLATFORM_EC_USBC + "${PLATFORM_EC_BOARD}/usbc_config.c" + "${PLATFORM_EC_BOARD}/fw_config.c") +zephyr_library_sources_ifdef(CONFIG_PLATFORM_EC_CHARGE_MANAGER + "${PLATFORM_EC_BOARD}/charger.c" + "${PLATFORM_EC}/common/math_util.c") diff --git a/zephyr/projects/brya/battery.dts b/zephyr/projects/brya/battery.dts new file mode 100644 index 0000000000..85bf217884 --- /dev/null +++ b/zephyr/projects/brya/battery.dts @@ -0,0 +1,15 @@ +/* Copyright 2022 The Chromium OS Authors. All rights reserved. + * Use of this source code is governed by a BSD-style license that can be + * found in the LICENSE file. + */ + +/ { + batteries { + default_battery: batgqa05l22 { + compatible = "powertech,batgqa05l22"; + }; + lgc_ac17a8m { + compatible = "lgc,ac17a8m"; + }; + }; +}; diff --git a/zephyr/projects/brya/battery_present.c b/zephyr/projects/brya/battery_present.c new file mode 100644 index 0000000000..3eb2e0295f --- /dev/null +++ b/zephyr/projects/brya/battery_present.c @@ -0,0 +1,21 @@ +/* Copyright 2022 The Chromium OS Authors. All rights reserved. + * Use of this source code is governed by a BSD-style license that can be + * found in the LICENSE file. + */ +#include + +#include "battery.h" +#include "cbi.h" + +enum battery_present battery_hw_present(void) +{ + const struct gpio_dt_spec *batt_pres; + + if (get_board_id() == 1) + batt_pres = GPIO_DT_FROM_NODELABEL(gpio_id_1_ec_batt_pres_odl); + else + batt_pres = GPIO_DT_FROM_NODELABEL(gpio_ec_batt_pres_odl); + + /* The GPIO is low when the battery is physically present */ + return gpio_pin_get_dt(batt_pres) ? BP_NO : BP_YES; +} diff --git a/zephyr/projects/brya/bb_retimer.dts b/zephyr/projects/brya/bb_retimer.dts new file mode 100644 index 0000000000..1921881e16 --- /dev/null +++ b/zephyr/projects/brya/bb_retimer.dts @@ -0,0 +1,24 @@ +/* Copyright 2022 The Chromium OS Authors. All rights reserved. + * Use of this source code is governed by a BSD-style license that can be + * found in the LICENSE file. + */ + +&i2c3_0 { + status = "okay"; + clock-frequency = ; + + usb_c0_bb_retimer: jhl8040r@56 { + compatible = "intel,jhl8040r"; + reg = <0x56>; + label = "USB_C0_BB_RETIMER"; + int-pin = <&usb_c0_rt_int_odl>; + reset-pin = <&usb_c0_rt_rst_odl>; + }; + usb_c2_bb_retimer: jhl8040r@57 { + compatible = "intel,jhl8040r"; + reg = <0x57>; + label = "USB_C2_BB_RETIMER"; + int-pin = <&usb_c2_rt_int_odl>; + reset-pin = <&usb_c2_rt_rst_odl>; + }; +}; diff --git a/zephyr/projects/brya/brya/BUILD.py b/zephyr/projects/brya/brya/BUILD.py deleted file mode 100644 index 4e2a556234..0000000000 --- a/zephyr/projects/brya/brya/BUILD.py +++ /dev/null @@ -1,22 +0,0 @@ -# Copyright 2021 The Chromium OS Authors. All rights reserved. -# Use of this source code is governed by a BSD-style license that can be -# found in the LICENSE file. - -brya = register_npcx_project( - project_name="brya", - zephyr_board="brya", - dts_overlays=[ - "battery.dts", - "bb_retimer.dts", - "cbi_eeprom.dts", - "fan.dts", - "gpio.dts", - "interrupts.dts", - "keyboard.dts", - "motionsense.dts", - "pwm_leds.dts", - "usbc.dts", - ], -) - -ghost = brya.variant(project_name="ghost") diff --git a/zephyr/projects/brya/brya/CMakeLists.txt b/zephyr/projects/brya/brya/CMakeLists.txt deleted file mode 100644 index 0cb61eb838..0000000000 --- a/zephyr/projects/brya/brya/CMakeLists.txt +++ /dev/null @@ -1,39 +0,0 @@ -# Copyright 2021 The Chromium OS Authors. All rights reserved. -# Use of this source code is governed by a BSD-style license that can be -# found in the LICENSE file. - -cmake_minimum_required(VERSION 3.13.1) - -find_package(Zephyr REQUIRED HINTS $ENV{ZEPHYR_BASE}) -project(brya) - -set(PLATFORM_EC_BOARD "${PLATFORM_EC}/board/brya" CACHE PATH - "Path to the platform/ec board directory") -set(PLATFORM_EC_BASEBOARD "${PLATFORM_EC}/baseboard/brya" CACHE PATH - "Path to the platform/ec baseboard directory") - -# Include board specific header files -zephyr_include_directories( - include - "${PLATFORM_EC}/driver/tcpm" - "${PLATFORM_EC_BASEBOARD}" - "${PLATFORM_EC_BOARD}") - -zephyr_library_sources_ifdef(CONFIG_PLATFORM_EC_BATTERY - "${PLATFORM_EC_BASEBOARD}/battery_presence.c") -zephyr_library_sources_ifdef(CONFIG_PLATFORM_EC_CBI_EEPROM - "${PLATFORM_EC_BASEBOARD}/cbi.c") -zephyr_library_sources_ifdef(CONFIG_PLATFORM_EC_PWM_KBLIGHT - "kblight_hooks.c") -zephyr_library_sources_ifdef(CONFIG_PLATFORM_EC_BATTERY - "${PLATFORM_EC_BASEBOARD}/battery_presence.c") -zephyr_library_sources_ifdef(CONFIG_PLATFORM_EC_BATTERY - "battery_present.c") -zephyr_library_sources_ifdef(CONFIG_PLATFORM_EC_USB_POWER_DELIVERY - "${PLATFORM_EC_BASEBOARD}/usb_pd_policy.c") -zephyr_library_sources_ifdef(CONFIG_PLATFORM_EC_USBC - "${PLATFORM_EC_BOARD}/usbc_config.c" - "${PLATFORM_EC_BOARD}/fw_config.c") -zephyr_library_sources_ifdef(CONFIG_PLATFORM_EC_CHARGE_MANAGER - "${PLATFORM_EC_BOARD}/charger.c" - "${PLATFORM_EC}/common/math_util.c") diff --git a/zephyr/projects/brya/brya/battery.dts b/zephyr/projects/brya/brya/battery.dts deleted file mode 100644 index 85bf217884..0000000000 --- a/zephyr/projects/brya/brya/battery.dts +++ /dev/null @@ -1,15 +0,0 @@ -/* Copyright 2022 The Chromium OS Authors. All rights reserved. - * Use of this source code is governed by a BSD-style license that can be - * found in the LICENSE file. - */ - -/ { - batteries { - default_battery: batgqa05l22 { - compatible = "powertech,batgqa05l22"; - }; - lgc_ac17a8m { - compatible = "lgc,ac17a8m"; - }; - }; -}; diff --git a/zephyr/projects/brya/brya/battery_present.c b/zephyr/projects/brya/brya/battery_present.c deleted file mode 100644 index 3eb2e0295f..0000000000 --- a/zephyr/projects/brya/brya/battery_present.c +++ /dev/null @@ -1,21 +0,0 @@ -/* Copyright 2022 The Chromium OS Authors. All rights reserved. - * Use of this source code is governed by a BSD-style license that can be - * found in the LICENSE file. - */ -#include - -#include "battery.h" -#include "cbi.h" - -enum battery_present battery_hw_present(void) -{ - const struct gpio_dt_spec *batt_pres; - - if (get_board_id() == 1) - batt_pres = GPIO_DT_FROM_NODELABEL(gpio_id_1_ec_batt_pres_odl); - else - batt_pres = GPIO_DT_FROM_NODELABEL(gpio_ec_batt_pres_odl); - - /* The GPIO is low when the battery is physically present */ - return gpio_pin_get_dt(batt_pres) ? BP_NO : BP_YES; -} diff --git a/zephyr/projects/brya/brya/bb_retimer.dts b/zephyr/projects/brya/brya/bb_retimer.dts deleted file mode 100644 index 1921881e16..0000000000 --- a/zephyr/projects/brya/brya/bb_retimer.dts +++ /dev/null @@ -1,24 +0,0 @@ -/* Copyright 2022 The Chromium OS Authors. All rights reserved. - * Use of this source code is governed by a BSD-style license that can be - * found in the LICENSE file. - */ - -&i2c3_0 { - status = "okay"; - clock-frequency = ; - - usb_c0_bb_retimer: jhl8040r@56 { - compatible = "intel,jhl8040r"; - reg = <0x56>; - label = "USB_C0_BB_RETIMER"; - int-pin = <&usb_c0_rt_int_odl>; - reset-pin = <&usb_c0_rt_rst_odl>; - }; - usb_c2_bb_retimer: jhl8040r@57 { - compatible = "intel,jhl8040r"; - reg = <0x57>; - label = "USB_C2_BB_RETIMER"; - int-pin = <&usb_c2_rt_int_odl>; - reset-pin = <&usb_c2_rt_rst_odl>; - }; -}; diff --git a/zephyr/projects/brya/brya/cbi_eeprom.dts b/zephyr/projects/brya/brya/cbi_eeprom.dts deleted file mode 100644 index 95a6806f31..0000000000 --- a/zephyr/projects/brya/brya/cbi_eeprom.dts +++ /dev/null @@ -1,16 +0,0 @@ -/* Copyright 2021 The Chromium OS Authors. All rights reserved. - * Use of this source code is governed by a BSD-style license that can be - * found in the LICENSE file. - */ - -&i2c7_0 { - cbi_eeprom: eeprom@50 { - compatible = "atmel,at24"; - reg = <0x50>; - label = "EEPROM_CBI"; - size = <2048>; - pagesize = <16>; - address-width = <8>; - timeout = <5>; - }; -}; diff --git a/zephyr/projects/brya/brya/fan.dts b/zephyr/projects/brya/brya/fan.dts deleted file mode 100644 index a0323b171b..0000000000 --- a/zephyr/projects/brya/brya/fan.dts +++ /dev/null @@ -1,35 +0,0 @@ -/* Copyright 2022 The Chromium OS Authors. All rights reserved. - * Use of this source code is governed by a BSD-style license that can be - * found in the LICENSE file. - */ - -/ { - named-fans { - compatible = "named-fans"; - - fan_0 { - label = "FAN_0"; - pwms = <&pwm5 0 PWM_POLARITY_NORMAL>; - pwm-frequency = <1000>; - rpm_min = <2200>; - rpm_start = <2200>; - rpm_max = <4200>; - tach = <&tach1>; - enable_gpio = <&gpio_en_pp5000_fan>; - }; - }; -}; - -/* Tachemeter for fan speed measurement */ -&tach1 { - status = "okay"; - pinctrl-0 = <&alt3_ta1_sl1>; /* Use TA1 as input pin */ - port = ; /* port-A is selected */ - sample-clk = ; /* Use LFCLK as sampling clock */ - pulses-per-round = <2>; /* number of pulses per round of encoder */ -}; - -&pwm5 { - status = "okay"; - drive-open-drain; -}; diff --git a/zephyr/projects/brya/brya/gpio.dts b/zephyr/projects/brya/brya/gpio.dts deleted file mode 100644 index 8769a62e13..0000000000 --- a/zephyr/projects/brya/brya/gpio.dts +++ /dev/null @@ -1,364 +0,0 @@ -/* Copyright 2021 The Chromium OS Authors. All rights reserved. - * Use of this source code is governed by a BSD-style license that can be - * found in the LICENSE file. - */ - -/ { - aliases { - gpio-wp = &gpio_ec_wp_l; - gpio-kbd-kso2 = &gpio_ec_kso_02_inv; - }; - - named-gpios { - compatible = "named-gpios"; - - lid_open: lid_open { - gpios = <&gpiod 2 GPIO_INPUT>; - enum-name = "GPIO_LID_OPEN"; - }; - gsc_ec_pwr_btn_odl: gsc_ec_pwr_btn_odl { - gpios = <&gpio0 1 GPIO_INPUT>; - enum-name = "GPIO_POWER_BUTTON_L"; - }; - gpio_ec_wp_l: ec_wp_odl { - gpios = <&gpioa 1 (GPIO_INPUT | GPIO_ACTIVE_LOW)>; - }; - charger_vap_otg_en { - gpios = <&gpio7 3 GPIO_OUTPUT_LOW>; - }; - gpio_ec_batt_pres_odl: ec_batt_pres_odl { - gpios = <&gpioa 3 GPIO_INPUT>; - enum-name = "GPIO_BATT_PRES_ODL"; - }; - /* - * Same GPIO as gpio_ec_batt_pres_odl, - * but only enabled for board id 1. - */ - gpio_id_1_ec_kb_bl_en: id_1_ec_kb_bl_en { - gpios = <&gpioa 3 GPIO_OUTPUT_LOW>; - no-auto-init; - }; - gpio_id_1_ec_batt_pres_odl: id_1_ec_batt_pres_odl { - gpios = <&gpioe 1 GPIO_INPUT>; - }; - ec_i2c_bat_scl { - gpios = <&gpio3 3 GPIO_INPUT>; - }; - ec_i2c_bat_sda { - gpios = <&gpio3 6 GPIO_INPUT>; - }; - gpio_ec_kb_bl_en_l: ec_kb_bl_en_l { - gpios = <&gpio8 6 GPIO_OUTPUT_HIGH>; - }; - ec_i2c_misc_scl_r { - gpios = <&gpiob 3 GPIO_INPUT>; - }; - ec_i2c_misc_sda_r { - gpios = <&gpiob 2 GPIO_INPUT>; - }; - ec_i2c_sensor_scl { - gpios = <&gpiob 5 GPIO_INPUT>; - }; - ec_i2c_sensor_sda { - gpios = <&gpiob 4 GPIO_INPUT>; - }; - ec_i2c_usb_c0_c2_ppc_bc_scl { - gpios = <&gpio9 2 GPIO_INPUT>; - }; - ec_i2c_usb_c0_c2_ppc_bc_sda { - gpios = <&gpio9 1 GPIO_INPUT>; - }; - ec_i2c_usb_c0_c2_rt_scl { - gpios = <&gpiod 1 GPIO_INPUT>; - }; - ec_i2c_usb_c0_c2_rt_sda { - gpios = <&gpiod 0 GPIO_INPUT>; - }; - ec_i2c_usb_c0_c2_tcpc_scl { - gpios = <&gpio9 0 GPIO_INPUT>; - }; - ec_i2c_usb_c0_c2_tcpc_sda { - gpios = <&gpio8 7 GPIO_INPUT>; - }; - ec_i2c_usb_c1_mix_scl { - gpios = <&gpioe 4 GPIO_INPUT>; - }; - ec_i2c_usb_c1_mix_sda { - gpios = <&gpioe 3 GPIO_INPUT>; - }; - ec_i2c_usb_c1_tcpc_scl { - gpios = <&gpiof 3 GPIO_INPUT>; - }; - ec_i2c_usb_c1_tcpc_sda { - gpios = <&gpiof 2 GPIO_INPUT>; - }; - ec_chg_led_y_c1 { - gpios = <&gpioc 3 GPIO_OUTPUT_LOW>; - }; - ec_chg_led_b_c1 { - gpios = <&gpioc 4 GPIO_OUTPUT_LOW>; - }; - ec_gsc_packet_mode { - gpios = <&gpio7 5 GPIO_OUTPUT_LOW>; - enum-name = "GPIO_PACKET_MODE_EN"; - }; - gpio_ec_accel_int_l: ec_accel_int_l { - gpios = <&gpio8 1 GPIO_INPUT>; - }; - gpio_ec_imu_int_l: gpio_ec_imu_int_l { - gpios = <&gpio5 6 GPIO_INPUT>; - }; - gpio_ec_als_rgb_int_l: gpio_ec_als_rgb_int_l { - gpios = <&gpiod 4 GPIO_INPUT>; - }; - gpio_tablet_mode_l: tablet_mode_l { - gpios = <&gpio9 5 GPIO_INPUT>; - enum-name = "GPIO_TABLET_MODE_L"; - }; - acok_od: acok_od { - gpios = <&gpio0 0 GPIO_INPUT>; - enum-name = "GPIO_AC_PRESENT"; - }; - gpio_ec_kso_02_inv: ec_kso_02_inv { - gpios = <&gpio1 7 (GPIO_OUTPUT_LOW | GPIO_ACTIVE_LOW)>; - }; - gpio_ec_pch_wake_odl: ec_pch_wake_r_odl { - gpios = <&gpioc 0 GPIO_ODR_HIGH>; - }; - ec_pch_int_odl { - gpios = <&gpiob 0 GPIO_ODR_HIGH>; - enum-name = "GPIO_EC_INT_L"; - }; - gpio_pg_ec_dsw_pwrok: pg_ec_dsw_pwrok { - gpios = <&gpioc 7 GPIO_INPUT>; - enum-name = "GPIO_PG_EC_DSW_PWROK"; - }; - en_s5_rails { - gpios = <&gpiob 6 GPIO_OUTPUT_LOW>; - enum-name = "GPIO_EN_S5_RAILS"; - }; - sys_rst_odl { - gpios = <&gpioc 5 GPIO_ODR_HIGH>; - enum-name = "GPIO_SYS_RESET_L"; - }; - gpio_pg_ec_rsmrst_odl: pg_ec_rsmrst_odl { - gpios = <&gpioe 2 GPIO_INPUT>; - enum-name = "GPIO_PG_EC_RSMRST_ODL"; - }; - ec_pch_rsmrst_odl { - gpios = <&gpioa 6 GPIO_OUTPUT_LOW>; - enum-name = "GPIO_PCH_RSMRST_L"; - }; - gpio_pg_ec_all_sys_pwrgd: pg_ec_all_sys_pwrgd { - gpios = <&gpiof 4 GPIO_INPUT>; - enum-name = "GPIO_PG_EC_ALL_SYS_PWRGD"; - }; - gpio_slp_s0_l: slp_s0_l { - gpios = <&gpiod 5 GPIO_INPUT>; - enum-name = "GPIO_PCH_SLP_S0_L"; - }; - gpio_slp_s3_l: slp_s3_l { - gpios = <&gpioa 5 GPIO_INPUT>; - enum-name = "GPIO_PCH_SLP_S3_L"; - }; - vccst_pwrgd_od { - gpios = <&gpioa 4 GPIO_ODR_LOW>; - enum-name = "GPIO_VCCST_PWRGD_OD"; - }; - ec_prochot_odl { - gpios = <&gpio6 3 GPIO_ODR_HIGH>; - enum-name = "GPIO_CPU_PROCHOT"; - }; - ec_pch_pwr_btn_odl { - gpios = <&gpioc 1 GPIO_ODR_HIGH>; - enum-name = "GPIO_PCH_PWRBTN_L"; - }; - gpio_slp_sus_l: slp_sus_l { - gpios = <&gpiof 1 GPIO_INPUT>; - enum-name = "GPIO_SLP_SUS_L"; - }; - pch_pwrok { - gpios = <&gpio7 2 GPIO_OUTPUT_LOW>; - enum-name = "GPIO_PCH_PWROK"; - }; - ec_pch_sys_pwrok { - gpios = <&gpio3 7 GPIO_OUTPUT_LOW>; - enum-name = "GPIO_EC_PCH_SYS_PWROK"; - }; - imvp9_vrrdy_od { - gpios = <&gpio4 3 GPIO_INPUT>; - enum-name = "GPIO_IMVP9_VRRDY_OD"; - }; - ec_edp_bl_en { - gpios = <&gpiod 3 GPIO_OUTPUT_HIGH>; - enum-name = "GPIO_ENABLE_BACKLIGHT"; - }; - gpio_ec_prochot_in_l: ec_prochot_in_l { - gpios = <&gpiof 0 GPIO_INPUT>; - }; - gpio_en_pp5000_fan: en_pp5000_fan { - gpios = <&gpio6 1 GPIO_OUTPUT_HIGH>; - }; - gpio_ec_voldn_btn_odl: ec_voldn_btn_odl { - gpios = <&gpio9 3 GPIO_INPUT_PULL_UP>; - enum-name = "GPIO_VOLUME_DOWN_L"; - }; - gpio_ec_volup_btn_odl: ec_volup_btn_odl { - gpios = <&gpio9 7 GPIO_INPUT_PULL_UP>; - enum-name = "GPIO_VOLUME_UP_L"; - }; - gpio_usb_c0_c2_tcpc_int_odl: usb_c0_c2_tcpc_int_odl { - gpios = <&gpioe 0 GPIO_INPUT>; - enum-name = "GPIO_USB_C0_C2_TCPC_INT_ODL"; - }; - gpio_usb_c1_tcpc_int_odl: usb_c1_tcpc_int_odl { - gpios = <&gpioa 2 GPIO_INPUT>; - enum-name = "GPIO_USB_C1_TCPC_INT_ODL"; - }; - gpio_usb_c0_ppc_int_odl: usb_c0_ppc_int_odl { - gpios = <&gpio6 2 GPIO_INPUT>; - enum-name = "GPIO_USB_C0_PPC_INT_ODL"; - }; - gpio_usb_c1_ppc_int_odl: usb_c1_ppc_int_odl { - gpios = <&gpiof 5 GPIO_INPUT>; - enum-name = "GPIO_USB_C1_PPC_INT_ODL"; - }; - gpio_usb_c2_ppc_int_odl: usb_c2_ppc_int_odl { - gpios = <&gpio7 0 GPIO_INPUT>; - enum-name = "GPIO_USB_C2_PPC_INT_ODL"; - }; - gpio_usb_c0_bc12_int_odl: usb_c0_bc12_int_odl { - gpios = <&gpioc 6 GPIO_INPUT>; - enum-name = "GPIO_USB_C0_BC12_INT_ODL"; - }; - gpio_usb_c1_bc12_int_odl: usb_c1_bc12_int_odl { - gpios = <&gpio5 0 GPIO_INPUT>; - enum-name = "GPIO_USB_C1_BC12_INT_ODL"; - }; - gpio_usb_c2_bc12_int_odl: usb_c2_bc12_int_odl { - gpios = <&gpio8 3 GPIO_INPUT>; - enum-name = "GPIO_USB_C2_BC12_INT_ODL"; - }; - en_pp5000_usba_r { - gpios = <&gpiod 7 GPIO_OUTPUT_LOW>; - enum-name = "GPIO_EN_PP5000_USBA_R"; - }; - usb_c1_rt_rst_r_odl { - gpios = <&gpio0 2 GPIO_ODR_LOW>; - enum-name = "GPIO_USB_C1_RT_RST_R_ODL"; - }; - usb_c1_rst_odl { - gpios = <&gpio9 6 GPIO_ODR_LOW>; - enum-name = "GPIO_USB_C1_RST_ODL"; - }; - usb_c0_c2_tcpc_rst_odl { - gpios = <&gpioa 7 GPIO_ODR_LOW>; - enum-name = "GPIO_USB_C0_C2_TCPC_RST_ODL"; - }; - id_1_usb_c0_c2_tcpc_rst_odl { - gpios = <&gpio3 4 GPIO_ODR_LOW>; - }; - usb_c0_int_odl { - gpios = <&gpiob 1 GPIO_INPUT>; - }; - usb_c2_int_odl { - gpios = <&gpio4 1 GPIO_INPUT>; - }; - usb_c0_rt_int_odl: usb_c0_rt_int_odl { - gpios = <&gpiob 1 GPIO_INPUT>; - }; - usb_c2_rt_int_odl: usb_c2_rt_int_odl { - gpios = <&gpio4 1 GPIO_INPUT>; - }; - }; - - named-ioexes { - compatible = "named-ioexes"; - - usb_c0_oc_odl { - gpios = <&ioex_port1 4 GPIO_ODR_HIGH>; - enum-name = "IOEX_USB_C0_OC_ODL"; - label = "IOEX_USB_C0_OC_ODL"; - }; - usb_c0_frs_en { - gpios = <&ioex_port1 6 GPIO_OUTPUT_LOW>; - enum-name = "IOEX_USB_C0_FRS_EN"; - label = "IOEX_USB_C0_FRS_EN"; - }; - usb_c0_rt_rst_odl: usb_c0_rt_rst_odl { - gpios = <&ioex_port1 7 GPIO_ODR_HIGH>; - enum-name = "IOEX_USB_C0_RT_RST_ODL"; - label = "IOEX_USB_C0_RT_RST_ODL"; - }; - usb_c2_rt_rst_odl: usb_c2_rt_rst_odl { - gpios = <&ioex_port2 2 GPIO_ODR_HIGH>; - enum-name = "IOEX_USB_C2_RT_RST_ODL"; - label = "IOEX_USB_C2_RT_RST_ODL"; - }; - usb_c1_oc_odl { - gpios = <&ioex_port2 3 GPIO_ODR_HIGH>; - enum-name = "IOEX_USB_C1_OC_ODL"; - label = "IOEX_USB_C1_OC_ODL"; - }; - usb_c2_oc_odl { - gpios = <&ioex_port2 4 GPIO_ODR_HIGH>; - enum-name = "IOEX_USB_C2_OC_ODL"; - label = "IOEX_USB_C2_OC_ODL"; - }; - usb_c2_frs_en { - gpios = <&ioex_port2 6 GPIO_OUTPUT_LOW>; - enum-name = "IOEX_USB_C2_FRS_EN"; - label = "IOEX_USB_C2_FRS_EN"; - }; - }; - -}; - -&i2c1_0 { - status = "okay"; - - nct3808_0_P1:nct3808_0_P1@70 { - #address-cells = <1>; - #size-cells = <0>; - compatible = "nuvoton,nct38xx-gpio"; - reg = <0x70>; - label = "NCT3808_0_P1"; - - ioex_port1:gpio@0 { - compatible = "nuvoton,nct38xx-gpio-port"; - reg = <0x0>; - label = "NCT3808_0_P1_GPIO0"; - gpio-controller; - #gpio-cells = <2>; - ngpios = <8>; - pin_mask = <0xdc>; - pinmux_mask = <0xff>; - }; - }; - - nct3808_0_P2:nct3808_0_P2@74 { - #address-cells = <1>; - #size-cells = <0>; - compatible = "nuvoton,nct38xx-gpio"; - reg = <0x74>; - label = "NCT3808_0_P2"; - - ioex_port2:gpio@0 { - compatible = "nuvoton,nct38xx-gpio-port"; - reg = <0x0>; - label = "NCT3808_0_P2_GPIO0"; - gpio-controller; - #gpio-cells = <2>; - ngpios = <8>; - pin_mask = <0xdc>; - pinmux_mask = <0xff>; - }; - }; - - nct3808_alert_1 { - compatible = "nuvoton,nct38xx-gpio-alert"; - irq-gpios = <&gpioe 0 (GPIO_PULL_UP | GPIO_ACTIVE_LOW)>; - nct38xx-dev = <&nct3808_0_P1 &nct3808_0_P2>; - label = "NCT3808_ALERT_1"; - }; -}; diff --git a/zephyr/projects/brya/brya/include/gpio_map.h b/zephyr/projects/brya/brya/include/gpio_map.h deleted file mode 100644 index c8ed6773a2..0000000000 --- a/zephyr/projects/brya/brya/include/gpio_map.h +++ /dev/null @@ -1,16 +0,0 @@ -/* Copyright 2021 The Chromium OS Authors. All rights reserved. - * Use of this source code is governed by a BSD-style license that can be - * found in the LICENSE file. - */ - -#ifndef __ZEPHYR_GPIO_MAP_H -#define __ZEPHYR_GPIO_MAP_H - -#include -#include - -#define GPIO_ENTERING_RW GPIO_UNIMPLEMENTED - -#define GPIO_SEQ_EC_DSW_PWROK GPIO_PG_EC_DSW_PWROK - -#endif /* __ZEPHYR_GPIO_MAP_H */ diff --git a/zephyr/projects/brya/brya/interrupts.dts b/zephyr/projects/brya/brya/interrupts.dts deleted file mode 100644 index 7132c12f77..0000000000 --- a/zephyr/projects/brya/brya/interrupts.dts +++ /dev/null @@ -1,150 +0,0 @@ -/* Copyright 2022 The Chromium OS Authors. All rights reserved. - * Use of this source code is governed by a BSD-style license that can be - * found in the LICENSE file. - */ - -/ { - aliases { - int-wp = &int_wp; - }; - - gpio-interrupts { - compatible = "cros-ec,gpio-interrupts"; - - int_tablet_mode: tablet_mode { - irq-pin = <&gpio_tablet_mode_l>; - flags = ; - handler = "gmr_tablet_switch_isr"; - }; - int_lid_open: lid_open { - irq-pin = <&lid_open>; - flags = ; - handler = "lid_interrupt"; - }; - int_power_button: power_button { - irq-pin = <&gsc_ec_pwr_btn_odl>; - flags = ; - handler = "power_button_interrupt"; - }; - int_wp: wp { - irq-pin = <&gpio_ec_wp_l>; - flags = ; - handler = "switch_interrupt"; - }; - int_ac_present: ac_present { - irq-pin = <&acok_od>; - flags = ; - handler = "extpower_interrupt"; - }; - int_volume_up: volume_up { - irq-pin = <&gpio_ec_volup_btn_odl>; - flags = ; - handler = "button_interrupt"; - }; - int_volume_down: volume_down { - irq-pin = <&gpio_ec_voldn_btn_odl>; - flags = ; - handler = "button_interrupt"; - }; - int_accel: accel { - irq-pin = <&gpio_ec_accel_int_l>; - flags = ; - handler = "lis2dw12_interrupt"; - }; - int_imu: imu { - irq-pin = <&gpio_ec_imu_int_l>; - flags = ; - handler = "lsm6dso_interrupt"; - }; - int_slp_s0: slp_s0 { - irq-pin = <&gpio_slp_s0_l>; - flags = ; - handler = "power_signal_interrupt"; - }; - int_slp_s3: slp_s3 { - irq-pin = <&gpio_slp_s3_l>; - flags = ; - handler = "power_signal_interrupt"; - }; - int_slp_sus: slp_sus { - irq-pin = <&gpio_slp_sus_l>; - flags = ; - handler = "power_signal_interrupt"; - }; - int_pg_dsw_pwrok: pg_dsw_pwrok { - irq-pin = <&gpio_pg_ec_dsw_pwrok>; - flags = ; - handler = "power_signal_interrupt"; - }; - int_pg_rsmrst_odl: pg_rsmrst_odl { - irq-pin = <&gpio_pg_ec_rsmrst_odl>; - flags = ; - handler = "power_signal_interrupt"; - }; - int_pg_all_sys_pwrgd: pg_all_sys_pwrgd { - irq-pin = <&gpio_pg_ec_all_sys_pwrgd>; - flags = ; - handler = "power_signal_interrupt"; - }; - int_als_rgb: als_rgb { - irq-pin = <&gpio_ec_als_rgb_int_l>; - flags = ; - handler = "tcs3400_interrupt"; - }; - int_prochot: prochot { - irq-pin = <&gpio_ec_prochot_in_l>; - flags = ; - handler = "throttle_ap_prochot_input_interrupt"; - }; - int_usb_c0_c2_tcpc: usb_c0_c2_tcpc { - irq-pin = <&gpio_usb_c0_c2_tcpc_int_odl>; - flags = ; - handler = "tcpc_alert_event"; - }; - int_usb_c1_tcpc: usb_c1_tcpc { - irq-pin = <&gpio_usb_c1_tcpc_int_odl>; - flags = ; - handler = "tcpc_alert_event"; - }; - int_usb_c0_ppc: usb_c0_ppc { - irq-pin = <&gpio_usb_c0_ppc_int_odl>; - flags = ; - handler = "ppc_interrupt"; - }; - int_usb_c1_ppc: usb_c1_ppc { - irq-pin = <&gpio_usb_c1_ppc_int_odl>; - flags = ; - handler = "ppc_interrupt"; - }; - int_usb_c2_ppc: usb_c2_ppc { - irq-pin = <&gpio_usb_c2_ppc_int_odl>; - flags = ; - handler = "ppc_interrupt"; - }; - int_usb_c0_bc12: usb_c0_bc12 { - irq-pin = <&gpio_usb_c0_bc12_int_odl>; - flags = ; - handler = "bc12_interrupt"; - }; - int_usb_c1_bc12: usb_c1_bc12 { - irq-pin = <&gpio_usb_c1_bc12_int_odl>; - flags = ; - handler = "bc12_interrupt"; - }; - int_usb_c2_bc12: usb_c2_bc12 { - irq-pin = <&gpio_usb_c2_bc12_int_odl>; - flags = ; - handler = "bc12_interrupt"; - }; - int_usb_c0_rt: usb_c0_rt { - irq-pin = <&usb_c0_rt_int_odl>; - flags = ; - handler = "retimer_interrupt"; - }; - int_usb_c2_rt: usb_c2_rt { - irq-pin = <&usb_c2_rt_int_odl>; - flags = ; - handler = "retimer_interrupt"; - }; - }; -}; diff --git a/zephyr/projects/brya/brya/kblight_hooks.c b/zephyr/projects/brya/brya/kblight_hooks.c deleted file mode 100644 index c56aeb5907..0000000000 --- a/zephyr/projects/brya/brya/kblight_hooks.c +++ /dev/null @@ -1,67 +0,0 @@ -/* Copyright 2022 The Chromium OS Authors. All rights reserved. - * Use of this source code is governed by a BSD-style license that can be - * found in the LICENSE file. - */ - -#include -#include - -#include -#include "cbi.h" -#include "hooks.h" - -/* Enable/Disable keyboard backlight gpio */ -static inline void kbd_backlight_enable(bool enable) -{ - if (get_board_id() == 1) - gpio_pin_set_dt(GPIO_DT_FROM_NODELABEL(gpio_id_1_ec_kb_bl_en), - enable); - else - gpio_pin_set_dt(GPIO_DT_FROM_NODELABEL(gpio_ec_kb_bl_en_l), - !enable); -} - -static void board_backlight_handler(struct ap_power_ev_callback *cb, - struct ap_power_ev_data data) -{ - bool enable; - - switch (data.event) { - default: - return; - - case AP_POWER_RESUME: - /* Called on AP S3 -> S0 transition */ - enable = true; - break; - - case AP_POWER_SUSPEND: - /* Called on AP S0 -> S3 transition */ - enable = false; - break; - } - kbd_backlight_enable(enable); -} - -/* - * Explicitly apply the board ID 1 *gpio.inc settings to pins that - * were reassigned on current boards. - */ -static void set_board_id_1_gpios(void) -{ - static struct ap_power_ev_callback cb; - - /* - * Add a callback for suspend/resume to - * control the keyboard backlight. - */ - ap_power_ev_init_callback(&cb, board_backlight_handler, - AP_POWER_RESUME | AP_POWER_SUSPEND); - ap_power_ev_add_callback(&cb); - - if (get_board_id() != 1) - return; - gpio_pin_configure_dt(GPIO_DT_FROM_NODELABEL(gpio_id_1_ec_kb_bl_en), - GPIO_OUTPUT_LOW); -} -DECLARE_HOOK(HOOK_INIT, set_board_id_1_gpios, HOOK_PRIO_FIRST); diff --git a/zephyr/projects/brya/brya/keyboard.dts b/zephyr/projects/brya/brya/keyboard.dts deleted file mode 100644 index fbcbeae63a..0000000000 --- a/zephyr/projects/brya/brya/keyboard.dts +++ /dev/null @@ -1,16 +0,0 @@ -/* Copyright 2022 The Chromium OS Authors. All rights reserved. - * Use of this source code is governed by a BSD-style license that can be - * found in the LICENSE file. - */ - -/ { - kblight { - compatible = "cros-ec,kblight-pwm"; - pwms = <&pwm3 0 PWM_POLARITY_NORMAL>; - frequency = <2400>; - }; -}; - -&pwm3 { - status = "okay"; -}; diff --git a/zephyr/projects/brya/brya/motionsense.dts b/zephyr/projects/brya/brya/motionsense.dts deleted file mode 100644 index dd3f479042..0000000000 --- a/zephyr/projects/brya/brya/motionsense.dts +++ /dev/null @@ -1,264 +0,0 @@ -/* - * Copyright (c) 2022 The Chromium OS Authors - * - * SPDX-License-Identifier: Apache-2.0 - */ - -#include - - -/ { - aliases { - /* - * motion sense's <>_INT_EVENT is handled - * by alias. Using the alias, each driver creates - * its own <>_INT_EVENT. - */ - lsm6dso-int = &base_accel; - lis2dw12-int = &lid_accel; - tcs3400-int = &als_clear; - }; - - /* - * Declare mutexes used by sensor drivers. - * A mutex node is used to create an instance of mutex_t. - * A mutex node is referenced by a sensor node if the - * corresponding sensor driver needs to use the - * instance of the mutex. - */ - motionsense-mutex { - compatible = "cros-ec,motionsense-mutex"; - mutex_lis2dw12: lis2dw12-mutex { - label = "LIS2DW12_MUTEX"; - }; - - mutex_lsm6dso: lsm6dso-mutex { - label = "LSM6DSO_MUTEX"; - }; - }; - - /* Rotation matrix used by drivers. */ - motionsense-rotation-ref { - compatible = "cros-ec,motionsense-rotation-ref"; - lid_rot_ref: lid-rotation-ref { - mat33 = <0 1 0 - 1 0 0 - 0 0 (-1)>; - }; - base_rot_ref: base-rotation-ref { - mat33 = <1 0 0 - 0 (-1) 0 - 0 0 (-1)>; - }; - }; - - /* - * Driver specific data. A driver-specific data can be shared with - * different motion sensors while they are using the same driver. - * - * If a node's compatible starts with "cros-ec,accelgyro-", it is for - * a common structure defined in accelgyro.h. - * e.g) compatible = "cros-ec,accelgyro-als-drv-data" is for - * "struct als_drv_data_t" in accelgyro.h - */ - motionsense-sensor-data { - lis2dw12_data: lis2dw12-drv-data { - compatible = "cros-ec,drvdata-lis2dw12"; - status = "okay"; - }; - - lsm6dso_data: lsm6dso-drv-data { - compatible = "cros-ec,drvdata-lsm6dso"; - status = "okay"; - }; - - tcs_clear_data: tcs3400-clear-drv-data { - compatible = "cros-ec,drvdata-tcs3400-clear"; - status = "okay"; - - als-drv-data { - compatible = "cros-ec,accelgyro-als-drv-data"; - als-cal { - scale = <1>; - uscale = <0>; - offset = <0>; - als-channel-scale { - compatible = - "cros-ec,accelgyro-als-channel-scale"; - k-channel-scale = <1>; - cover-scale = <1>; - }; - }; - }; - }; - - tcs_rgb_data: tcs3400-rgb-drv-data { - compatible = "cros-ec,drvdata-tcs3400-rgb"; - status = "okay"; - - /* node for rgb_calibration_t defined in accelgyro.h */ - rgb_calibration { - compatible = - "cros-ec,accelgyro-rgb-calibration"; - - irt = <1>; - - rgb-cal-x { - offset = <0>; - coeff = <0 0 0 1>; - als-channel-scale { - compatible = - "cros-ec,accelgyro-als-channel-scale"; - k-channel-scale = <1>; - cover-scale = <1>; - }; - }; - rgb-cal-y { - offset = <0>; - coeff = <0 0 0 1>; - als-channel-scale { - compatible = - "cros-ec,accelgyro-als-channel-scale"; - k-channel-scale = <1>; - cover-scale = <1>; - }; - }; - rgb-cal-z { - offset = <0>; - coeff = <0 0 0 1>; - als-channel-scale { - compatible = - "cros-ec,accelgyro-als-channel-scale"; - k-channel-scale = <1>; - cover-scale = <1>; - }; - }; - }; - }; - }; - - /* - * List of motion sensors that creates motion_sensors array. - * The label "lid_accel" and "base_accel" are used to indicate - * motion sensor IDs for lid angle calculation. - */ - motionsense-sensor { - lid_accel: lid-accel { - compatible = "cros-ec,lis2dw12"; - status = "okay"; - - label = "Lid Accel"; - active-mask = "SENSOR_ACTIVE_S0_S3"; - location = "MOTIONSENSE_LOC_LID"; - mutex = <&mutex_lis2dw12>; - port = <&i2c_sensor>; - rot-standard-ref = <&lid_rot_ref>; - default-range = <2>; - drv-data = <&lis2dw12_data>; - i2c-spi-addr-flags = "LIS2DWL_ADDR0_FLAGS"; - configs { - compatible = - "cros-ec,motionsense-sensor-config"; - ec-s0 { - label = "SENSOR_CONFIG_EC_S0"; - odr = <(10000 | ROUND_UP_FLAG)>; - }; - ec-s3 { - label = "SENSOR_CONFIG_EC_S3"; - odr = <(10000 | ROUND_UP_FLAG)>; - }; - }; - }; - - base_accel: base-accel { - compatible = "cros-ec,lsm6dso-accel"; - status = "okay"; - - label = "Base Accel"; - active-mask = "SENSOR_ACTIVE_S0_S3"; - location = "MOTIONSENSE_LOC_BASE"; - mutex = <&mutex_lsm6dso>; - port = <&i2c_sensor>; - rot-standard-ref = <&base_rot_ref>; - default-range = <4>; - drv-data = <&lsm6dso_data>; - i2c-spi-addr-flags = "LSM6DSO_ADDR0_FLAGS"; - configs { - compatible = - "cros-ec,motionsense-sensor-config"; - ec-s0 { - label = "SENSOR_CONFIG_EC_S0"; - odr = <(13000 | ROUND_UP_FLAG)>; - ec-rate = <(100 * USEC_PER_MSEC)>; - }; - ec-s3 { - label = "SENSOR_CONFIG_EC_S3"; - odr = <(10000 | ROUND_UP_FLAG)>; - ec-rate = <(100 * USEC_PER_MSEC)>; - }; - }; - }; - - base-gyro { - compatible = "cros-ec,lsm6dso-gyro"; - status = "okay"; - - label = "Base Gyro"; - active-mask = "SENSOR_ACTIVE_S0_S3"; - location = "MOTIONSENSE_LOC_BASE"; - mutex = <&mutex_lsm6dso>; - port = <&i2c_sensor>; - rot-standard-ref = <&base_rot_ref>; - default-range = <(1000 | ROUND_UP_FLAG)>; /* dps */ - drv-data = <&lsm6dso_data>; - i2c-spi-addr-flags = "LSM6DSO_ADDR0_FLAGS"; - }; - - als_clear: base-als-clear { - compatible = "cros-ec,tcs3400-clear"; - status = "okay"; - - label = "Clear Light"; - active-mask = "SENSOR_ACTIVE_S0_S3"; - location = "MOTIONSENSE_LOC_CAMERA"; - port = <&i2c_sensor>; - default-range = <0x10000>; - drv-data = <&tcs_clear_data>; - i2c-spi-addr-flags = "TCS3400_I2C_ADDR_FLAGS"; - configs { - compatible = - "cros-ec,motionsense-sensor-config"; - ec-s0 { - /* Run ALS sensor in S0 */ - label = "SENSOR_CONFIG_EC_S0"; - odr = <1000>; - }; - }; - }; - - base-als-rgb { - compatible = "cros-ec,tcs3400-rgb"; - status = "okay"; - - label = "RGB Light"; - active-mask = "SENSOR_ACTIVE_S0_S3"; - location = "MOTIONSENSE_LOC_CAMERA"; - default-range = <0x10000>; /* scale = 1x, uscale = 0 */ - drv-data = <&tcs_rgb_data>; - }; - }; - - motionsense-sensor-info { - compatible = "cros-ec,motionsense-sensor-info"; - - /* list of entries for motion_als_sensors */ - als-sensors = <&als_clear>; - /* - * list of GPIO interrupts that have to - * be enabled at initial stage - */ - sensor-irqs = <&int_imu &int_als_rgb &int_accel>; - /* list of sensors in force mode */ - accel-force-mode-sensors = <&lid_accel &als_clear>; - }; -}; diff --git a/zephyr/projects/brya/brya/prj.conf b/zephyr/projects/brya/brya/prj.conf deleted file mode 100644 index abe72aa3a1..0000000000 --- a/zephyr/projects/brya/brya/prj.conf +++ /dev/null @@ -1,208 +0,0 @@ -# Copyright 2021 The Chromium OS Authors. All rights reserved. -# Use of this source code is governed by a BSD-style license that can be -# found in the LICENSE file. - -CONFIG_CROS_EC=y -CONFIG_PLATFORM_EC=y -CONFIG_SHIMMED_TASKS=y -CONFIG_PLATFORM_EC_POWER_BUTTON=y -CONFIG_PLATFORM_EC_LID_SWITCH=y -CONFIG_PLATFORM_EC_SWITCH=y -CONFIG_LTO=y -CONFIG_CROS_FLASH_NPCX=y -CONFIG_CROS_SYSTEM_NPCX=y -CONFIG_PLATFORM_EC_VBOOT_EFS2=y -CONFIG_PLATFORM_EC_VBOOT_HASH=y -CONFIG_PLATFORM_EC_EXTPOWER_GPIO=y -CONFIG_PLATFORM_EC_CONSOLE_CMD_SYSINFO=y -CONFIG_PLATFORM_EC_I2C=y - -CONFIG_PLATFORM_EC_ADC_CHANNELS_RUNTIME_CONFIG=y - -# SoC configuration -CONFIG_AP=y -CONFIG_AP_X86_INTEL_ADL=y -CONFIG_FPU=y -CONFIG_ARM_MPU=y - -# CBI -CONFIG_EEPROM=y -CONFIG_EEPROM_AT24=y -CONFIG_EEPROM_SHELL=n -CONFIG_PLATFORM_EC_CBI_EEPROM=y -CONFIG_PLATFORM_EC_BOARD_VERSION_CBI=y - -# eSPI -CONFIG_ESPI=y -CONFIG_PLATFORM_EC_ESPI_VW_SLP_S4=y -CONFIG_PLATFORM_EC_ESPI_VW_SLP_S5=y - -# Power Sequencing -CONFIG_PLATFORM_EC_POWERSEQ=y -CONFIG_PLATFORM_EC_POWERSEQ_RTC_RESET=y -CONFIG_PLATFORM_EC_POWERSEQ_S0IX=y -CONFIG_PLATFORM_EC_POWERSEQ_S4=y -CONFIG_PLATFORM_EC_POWER_SLEEP_FAILURE_DETECTION=y -CONFIG_PLATFORM_EC_THROTTLE_AP=y - -# Host command -CONFIG_PLATFORM_EC_HOSTCMD=y -CONFIG_PLATFORM_EC_HOSTCMD_AP_RESET=y - -# Console command -CONFIG_PLATFORM_EC_CONSOLE_CMD_ACCELS=y -CONFIG_PLATFORM_EC_CONSOLE_CMD_ACCEL_INFO=y -CONFIG_PLATFORM_EC_CONSOLE_CMD_I2C_SPEED=y - -# Sensors -CONFIG_PLATFORM_EC_MOTIONSENSE=y -CONFIG_PLATFORM_EC_ACCEL_FIFO=y -CONFIG_PLATFORM_EC_ACCEL_INTERRUPTS=y -CONFIG_PLATFORM_EC_ALS=y -CONFIG_PLATFORM_EC_DYNAMIC_MOTION_SENSOR_COUNT=y -CONFIG_PLATFORM_EC_GMR_TABLET_MODE=y -CONFIG_PLATFORM_EC_LID_ANGLE=y -CONFIG_PLATFORM_EC_LID_ANGLE_UPDATE=y -CONFIG_PLATFORM_EC_SENSOR_TIGHT_TIMESTAMPS=y -CONFIG_PLATFORM_EC_TABLET_MODE=y -CONFIG_PLATFORM_EC_TABLET_MODE_SWITCH=y - -# Sensor Drivers -CONFIG_PLATFORM_EC_ACCELGYRO_LSM6DSO=y -CONFIG_PLATFORM_EC_ACCEL_LIS2DW12=y -CONFIG_PLATFORM_EC_ACCEL_LIS2DW12_AS_BASE=y -CONFIG_PLATFORM_EC_ALS_TCS3400=y - -# Fan -CONFIG_PLATFORM_EC_FAN=y -CONFIG_SENSOR=y -CONFIG_SENSOR_SHELL=n -CONFIG_TACH_NPCX=y - -# Temperature sensors -CONFIG_PLATFORM_EC_TEMP_SENSOR=y -CONFIG_PLATFORM_EC_THERMISTOR=y - -# Miscellaneous configs -CONFIG_PLATFORM_EC_HIBERNATE_PSL=y - -# MKBP event -CONFIG_PLATFORM_EC_MKBP_EVENT=y -CONFIG_PLATFORM_EC_MKBP_INPUT_DEVICES=y -CONFIG_PLATFORM_EC_MKBP_USE_HOST_EVENT=y - -# MKBP event mask -CONFIG_PLATFORM_EC_MKBP_EVENT_WAKEUP_MASK=y -CONFIG_PLATFORM_EC_MKBP_HOST_EVENT_WAKEUP_MASK=y - -# PMIC -CONFIG_PLATFORM_EC_PMIC=y -CONFIG_PLATFORM_EC_MP2964=y - -# Keyboard -CONFIG_PLATFORM_EC_KEYBOARD=y -CONFIG_PLATFORM_EC_KEYBOARD_PROTOCOL_8042=y -CONFIG_PLATFORM_EC_KEYBOARD_COL2_INVERTED=y -CONFIG_PLATFORM_EC_KEYBOARD_KEYPAD=y -CONFIG_PLATFORM_EC_KEYBOARD_PWRBTN_ASSERTS_KSI3=y -CONFIG_PLATFORM_EC_VOLUME_BUTTONS=y -CONFIG_PLATFORM_EC_CMD_BUTTON=n -CONFIG_CROS_KB_RAW_NPCX=y - -# Keyboard Backlight -CONFIG_PLATFORM_EC_PWM_KBLIGHT=y - -CONFIG_PLATFORM_EC_WORKAROUND_FLASH_DOWNLOAD_API=y - -# Battery -CONFIG_PLATFORM_EC_BATTERY=y -CONFIG_PLATFORM_EC_BATTERY_SMART=y -CONFIG_PLATFORM_EC_BATTERY_FUEL_GAUGE=y -CONFIG_PLATFORM_EC_BATTERY_CUT_OFF=y -CONFIG_PLATFORM_EC_BATTERY_HW_PRESENT_CUSTOM=y -CONFIG_PLATFORM_EC_BATTERY_REVIVE_DISCONNECT=y - -# USB-C and charging -CONFIG_PLATFORM_EC_CHARGER_BQ25720=y -CONFIG_PLATFORM_EC_CHARGER_BQ25720_VSYS_TH2_CUSTOM=y -CONFIG_PLATFORM_EC_CHARGER_BQ25720_VSYS_TH2_DV=70 -CONFIG_PLATFORM_EC_CHARGER_DISCHARGE_ON_AC=y -CONFIG_PLATFORM_EC_CHARGER_DISCHARGE_ON_AC_CHARGER=y -CONFIG_PLATFORM_EC_CHARGER_MIN_BAT_PCT_FOR_POWER_ON=3 -CONFIG_PLATFORM_EC_CHARGER_MIN_BAT_PCT_FOR_POWER_ON_WITH_AC=1 -CONFIG_PLATFORM_EC_CHARGER_MIN_POWER_MW_FOR_POWER_ON_WITH_BATT=15000 -CONFIG_PLATFORM_EC_CHARGER_MIN_POWER_MW_FOR_POWER_ON=15001 -CONFIG_PLATFORM_EC_CHARGER_SENSE_RESISTOR=10 -CONFIG_PLATFORM_EC_CHARGER_SENSE_RESISTOR_AC=10 -CONFIG_PLATFORM_EC_CHARGE_RAMP_SW=y -CONFIG_PLATFORM_EC_BC12_DETECT_PI3USB9201=y -CONFIG_PLATFORM_EC_USB_PID=0x504F -CONFIG_PLATFORM_EC_USBC_PPC_SYV682X=y -CONFIG_PLATFORM_EC_USBC_PPC_NX20P3483=y -CONFIG_PLATFORM_EC_USBC_RETIMER_INTEL_BB=y -CONFIG_PLATFORM_EC_USB_DRP_ACC_TRYSRC=y -CONFIG_PLATFORM_EC_USB_MUX_VIRTUAL=y -CONFIG_PLATFORM_EC_USB_MUX_RUNTIME_CONFIG=n -CONFIG_PLATFORM_EC_USB_PD_DEBUG_FIXED_LEVEL=y -CONFIG_PLATFORM_EC_USB_PD_DEBUG_LEVEL=2 -CONFIG_PLATFORM_EC_USB_PD_ALT_MODE_UFP=y -CONFIG_PLATFORM_EC_USB_PD_VBUS_MEASURE_CHARGER=y -CONFIG_PLATFORM_EC_USB_PD_DISCHARGE_PPC=y -CONFIG_PLATFORM_EC_USB_PD_PPC=y -CONFIG_PLATFORM_EC_USB_PD_REV30=y -CONFIG_PLATFORM_EC_USB_PD_VBUS_DETECT_TCPC=y -CONFIG_PLATFORM_EC_USB_PD_TCPM_PS8815=y -CONFIG_PLATFORM_EC_USB_PD_TCPM_RT1715=n -CONFIG_PLATFORM_EC_USB_PD_TCPM_TUSB422=n -CONFIG_PLATFORM_EC_USB_PD_TCPM_NCT38XX=y -CONFIG_PLATFORM_EC_USB_PD_TCPM_MUX=y -CONFIG_PLATFORM_EC_USB_PD_PORT_MAX_COUNT=3 -CONFIG_PLATFORM_EC_USB_PD_TCPM_TCPCI=y -CONFIG_PLATFORM_EC_USBC_PPC_DEDICATED_INT=y -CONFIG_PLATFORM_EC_USBA=y -CONFIG_PLATFORM_EC_USB_A_PORT_COUNT=1 -CONFIG_PLATFORM_EC_USB_PORT_POWER_DUMB=y -CONFIG_PLATFORM_EC_CONSOLE_CMD_PPC_DUMP=n -CONFIG_PLATFORM_EC_CONSOLE_CMD_TCPC_DUMP=n -CONFIG_PLATFORM_EC_USB_PD_TCPC_RUNTIME_CONFIG=n -CONFIG_PLATFORM_EC_USB_PD_REQUIRE_AP_MODE_ENTRY=y -CONFIG_PLATFORM_EC_USB_PD_INT_SHARED=y -CONFIG_PLATFORM_EC_USB_PD_PORT_0_SHARED=y -CONFIG_PLATFORM_EC_USB_PD_PORT_2_SHARED=y - -CONFIG_SYSCON=y - -# LED -CONFIG_PLATFORM_EC_LED_COMMON=y -CONFIG_PLATFORM_EC_LED_PWM=y -CONFIG_PLATFORM_EC_CONSOLE_CMD_LEDTEST=n -CONFIG_PLATFORM_EC_LED_PWM_NEAR_FULL_COLOR=4 -CONFIG_PLATFORM_EC_LED_PWM_SOC_ON_COLOR=4 -CONFIG_PLATFORM_EC_LED_PWM_SOC_SUSPEND_COLOR=4 -CONFIG_PLATFORM_EC_LED_PWM_LOW_BATT_COLOR=5 - -# PWM -CONFIG_PWM=y -CONFIG_PWM_SHELL=n - -#IOEX -CONFIG_PLATFORM_EC_IOEX=y -CONFIG_PLATFORM_EC_CONSOLE_CMD_IOEX=y -CONFIG_GPIO_NCT38XX=y - -# TODO(b/188605676): bring these features up -CONFIG_PLATFORM_EC_BOARD_VERSION_GPIO=n - -# Power Sequencing -CONFIG_PLATFORM_EC_POWERSEQ=y -CONFIG_PLATFORM_EC_POWERSEQ_PP5000_CONTROL=n -CONFIG_CHIPSET_ALDERLAKE_SLG4BD44540=y -CONFIG_PLATFORM_EC_POWERSEQ_RTC_RESET=n -CONFIG_PLATFORM_EC_POWERSEQ_S0IX=y -CONFIG_PLATFORM_EC_POWER_SLEEP_FAILURE_DETECTION=y -# Treat 2nd reset from H1 as Power-On -CONFIG_PLATFORM_EC_BOARD_RESET_AFTER_POWER_ON=y -CONFIG_PLATFORM_EC_THROTTLE_AP=y - -# RTC -CONFIG_PLATFORM_EC_RTC=y diff --git a/zephyr/projects/brya/brya/pwm_leds.dts b/zephyr/projects/brya/brya/pwm_leds.dts deleted file mode 100644 index 5d4a3992b5..0000000000 --- a/zephyr/projects/brya/brya/pwm_leds.dts +++ /dev/null @@ -1,72 +0,0 @@ -/* Copyright 2022 The Chromium OS Authors. All rights reserved. - * Use of this source code is governed by a BSD-style license that can be - * found in the LICENSE file. - */ - -/ { - pwmleds { - compatible = "pwm-leds"; - pwm_led0: pwm_led_0 { - pwms = <&pwm2 0 PWM_POLARITY_INVERTED - &pwm0 0 PWM_POLARITY_INVERTED>; - }; - pwm_led1: pwm_led_1 { - pwms = <&pwm1 0 PWM_POLARITY_INVERTED - &pwm7 0 PWM_POLARITY_INVERTED>; - }; - }; - - cros-pwmleds { - compatible = "cros-ec,pwm-leds"; - - leds = <&pwm_led0 &pwm_led1>; - frequency = <4800>; - - /**/ - color-map-red = <0 0>; - color-map-green = <0 0>; - color-map-blue = <0 0>; - color-map-yellow = <0 0>; - color-map-white = <0 50>; - color-map-amber = <50 0>; - - brightness-range = <0 0 0 0 100 100>; - - #address-cells = <1>; - #size-cells = <0>; - - pwm_led_0@0 { - reg = <0>; - ec-led-name = "EC_LED_ID_LEFT_LED"; - }; - - pwm_led_1@1 { - reg = <1>; - ec-led-name = "EC_LED_ID_RIGHT_LED"; - }; - }; -}; - -/* LED2 */ -&pwm0 { - status = "okay"; - clock-bus = "NPCX_CLOCK_BUS_LFCLK"; -}; - -/* LED3 */ -&pwm1 { - status = "okay"; - clock-bus = "NPCX_CLOCK_BUS_LFCLK"; -}; - -/* LED1 */ -&pwm2 { - status = "okay"; - clock-bus = "NPCX_CLOCK_BUS_LFCLK"; -}; - -/* LED4 */ -&pwm7 { - status = "okay"; - clock-bus = "NPCX_CLOCK_BUS_LFCLK"; -}; diff --git a/zephyr/projects/brya/brya/usbc.dts b/zephyr/projects/brya/brya/usbc.dts deleted file mode 100644 index e4458b8fb6..0000000000 --- a/zephyr/projects/brya/brya/usbc.dts +++ /dev/null @@ -1,52 +0,0 @@ -/* Copyright 2022 The Chromium OS Authors. All rights reserved. - * Use of this source code is governed by a BSD-style license that can be - * found in the LICENSE file. - */ - -/ { - usbc { - compatible = "named-usbc-ports"; - #address-cells = <1>; - #size-cells = <0>; - port0: usbc-port0@0 { - reg = <0>; - bc12 { - compatible = "pericom,pi3usb9201"; - status = "okay"; - irq = <&int_usb_c0_bc12>; - port = <&c0_c2_bc12>; - i2c-addr-flags = "PI3USB9201_I2C_ADDR_3_FLAGS"; - }; - tcpc { - compatible = "nuvoton,nct38xx"; - gpio-dev = <&nct3808_0_P1>; - }; - }; - - port1: usbc-port1@1 { - reg = <1>; - bc12 { - compatible = "pericom,pi3usb9201"; - status = "okay"; - irq = <&int_usb_c1_bc12>; - port = <&c1_bc12>; - i2c-addr-flags = "PI3USB9201_I2C_ADDR_3_FLAGS"; - }; - }; - - port2: usbc-port2@2 { - reg = <2>; - bc12 { - compatible = "pericom,pi3usb9201"; - status = "okay"; - irq = <&int_usb_c2_bc12>; - port = <&c0_c2_bc12>; - i2c-addr-flags = "PI3USB9201_I2C_ADDR_1_FLAGS"; - }; - tcpc { - compatible = "nuvoton,nct38xx"; - gpio-dev = <&nct3808_0_P2>; - }; - }; - }; -}; diff --git a/zephyr/projects/brya/cbi_eeprom.dts b/zephyr/projects/brya/cbi_eeprom.dts new file mode 100644 index 0000000000..95a6806f31 --- /dev/null +++ b/zephyr/projects/brya/cbi_eeprom.dts @@ -0,0 +1,16 @@ +/* Copyright 2021 The Chromium OS Authors. All rights reserved. + * Use of this source code is governed by a BSD-style license that can be + * found in the LICENSE file. + */ + +&i2c7_0 { + cbi_eeprom: eeprom@50 { + compatible = "atmel,at24"; + reg = <0x50>; + label = "EEPROM_CBI"; + size = <2048>; + pagesize = <16>; + address-width = <8>; + timeout = <5>; + }; +}; diff --git a/zephyr/projects/brya/fan.dts b/zephyr/projects/brya/fan.dts new file mode 100644 index 0000000000..a0323b171b --- /dev/null +++ b/zephyr/projects/brya/fan.dts @@ -0,0 +1,35 @@ +/* Copyright 2022 The Chromium OS Authors. All rights reserved. + * Use of this source code is governed by a BSD-style license that can be + * found in the LICENSE file. + */ + +/ { + named-fans { + compatible = "named-fans"; + + fan_0 { + label = "FAN_0"; + pwms = <&pwm5 0 PWM_POLARITY_NORMAL>; + pwm-frequency = <1000>; + rpm_min = <2200>; + rpm_start = <2200>; + rpm_max = <4200>; + tach = <&tach1>; + enable_gpio = <&gpio_en_pp5000_fan>; + }; + }; +}; + +/* Tachemeter for fan speed measurement */ +&tach1 { + status = "okay"; + pinctrl-0 = <&alt3_ta1_sl1>; /* Use TA1 as input pin */ + port = ; /* port-A is selected */ + sample-clk = ; /* Use LFCLK as sampling clock */ + pulses-per-round = <2>; /* number of pulses per round of encoder */ +}; + +&pwm5 { + status = "okay"; + drive-open-drain; +}; diff --git a/zephyr/projects/brya/gpio.dts b/zephyr/projects/brya/gpio.dts new file mode 100644 index 0000000000..8769a62e13 --- /dev/null +++ b/zephyr/projects/brya/gpio.dts @@ -0,0 +1,364 @@ +/* Copyright 2021 The Chromium OS Authors. All rights reserved. + * Use of this source code is governed by a BSD-style license that can be + * found in the LICENSE file. + */ + +/ { + aliases { + gpio-wp = &gpio_ec_wp_l; + gpio-kbd-kso2 = &gpio_ec_kso_02_inv; + }; + + named-gpios { + compatible = "named-gpios"; + + lid_open: lid_open { + gpios = <&gpiod 2 GPIO_INPUT>; + enum-name = "GPIO_LID_OPEN"; + }; + gsc_ec_pwr_btn_odl: gsc_ec_pwr_btn_odl { + gpios = <&gpio0 1 GPIO_INPUT>; + enum-name = "GPIO_POWER_BUTTON_L"; + }; + gpio_ec_wp_l: ec_wp_odl { + gpios = <&gpioa 1 (GPIO_INPUT | GPIO_ACTIVE_LOW)>; + }; + charger_vap_otg_en { + gpios = <&gpio7 3 GPIO_OUTPUT_LOW>; + }; + gpio_ec_batt_pres_odl: ec_batt_pres_odl { + gpios = <&gpioa 3 GPIO_INPUT>; + enum-name = "GPIO_BATT_PRES_ODL"; + }; + /* + * Same GPIO as gpio_ec_batt_pres_odl, + * but only enabled for board id 1. + */ + gpio_id_1_ec_kb_bl_en: id_1_ec_kb_bl_en { + gpios = <&gpioa 3 GPIO_OUTPUT_LOW>; + no-auto-init; + }; + gpio_id_1_ec_batt_pres_odl: id_1_ec_batt_pres_odl { + gpios = <&gpioe 1 GPIO_INPUT>; + }; + ec_i2c_bat_scl { + gpios = <&gpio3 3 GPIO_INPUT>; + }; + ec_i2c_bat_sda { + gpios = <&gpio3 6 GPIO_INPUT>; + }; + gpio_ec_kb_bl_en_l: ec_kb_bl_en_l { + gpios = <&gpio8 6 GPIO_OUTPUT_HIGH>; + }; + ec_i2c_misc_scl_r { + gpios = <&gpiob 3 GPIO_INPUT>; + }; + ec_i2c_misc_sda_r { + gpios = <&gpiob 2 GPIO_INPUT>; + }; + ec_i2c_sensor_scl { + gpios = <&gpiob 5 GPIO_INPUT>; + }; + ec_i2c_sensor_sda { + gpios = <&gpiob 4 GPIO_INPUT>; + }; + ec_i2c_usb_c0_c2_ppc_bc_scl { + gpios = <&gpio9 2 GPIO_INPUT>; + }; + ec_i2c_usb_c0_c2_ppc_bc_sda { + gpios = <&gpio9 1 GPIO_INPUT>; + }; + ec_i2c_usb_c0_c2_rt_scl { + gpios = <&gpiod 1 GPIO_INPUT>; + }; + ec_i2c_usb_c0_c2_rt_sda { + gpios = <&gpiod 0 GPIO_INPUT>; + }; + ec_i2c_usb_c0_c2_tcpc_scl { + gpios = <&gpio9 0 GPIO_INPUT>; + }; + ec_i2c_usb_c0_c2_tcpc_sda { + gpios = <&gpio8 7 GPIO_INPUT>; + }; + ec_i2c_usb_c1_mix_scl { + gpios = <&gpioe 4 GPIO_INPUT>; + }; + ec_i2c_usb_c1_mix_sda { + gpios = <&gpioe 3 GPIO_INPUT>; + }; + ec_i2c_usb_c1_tcpc_scl { + gpios = <&gpiof 3 GPIO_INPUT>; + }; + ec_i2c_usb_c1_tcpc_sda { + gpios = <&gpiof 2 GPIO_INPUT>; + }; + ec_chg_led_y_c1 { + gpios = <&gpioc 3 GPIO_OUTPUT_LOW>; + }; + ec_chg_led_b_c1 { + gpios = <&gpioc 4 GPIO_OUTPUT_LOW>; + }; + ec_gsc_packet_mode { + gpios = <&gpio7 5 GPIO_OUTPUT_LOW>; + enum-name = "GPIO_PACKET_MODE_EN"; + }; + gpio_ec_accel_int_l: ec_accel_int_l { + gpios = <&gpio8 1 GPIO_INPUT>; + }; + gpio_ec_imu_int_l: gpio_ec_imu_int_l { + gpios = <&gpio5 6 GPIO_INPUT>; + }; + gpio_ec_als_rgb_int_l: gpio_ec_als_rgb_int_l { + gpios = <&gpiod 4 GPIO_INPUT>; + }; + gpio_tablet_mode_l: tablet_mode_l { + gpios = <&gpio9 5 GPIO_INPUT>; + enum-name = "GPIO_TABLET_MODE_L"; + }; + acok_od: acok_od { + gpios = <&gpio0 0 GPIO_INPUT>; + enum-name = "GPIO_AC_PRESENT"; + }; + gpio_ec_kso_02_inv: ec_kso_02_inv { + gpios = <&gpio1 7 (GPIO_OUTPUT_LOW | GPIO_ACTIVE_LOW)>; + }; + gpio_ec_pch_wake_odl: ec_pch_wake_r_odl { + gpios = <&gpioc 0 GPIO_ODR_HIGH>; + }; + ec_pch_int_odl { + gpios = <&gpiob 0 GPIO_ODR_HIGH>; + enum-name = "GPIO_EC_INT_L"; + }; + gpio_pg_ec_dsw_pwrok: pg_ec_dsw_pwrok { + gpios = <&gpioc 7 GPIO_INPUT>; + enum-name = "GPIO_PG_EC_DSW_PWROK"; + }; + en_s5_rails { + gpios = <&gpiob 6 GPIO_OUTPUT_LOW>; + enum-name = "GPIO_EN_S5_RAILS"; + }; + sys_rst_odl { + gpios = <&gpioc 5 GPIO_ODR_HIGH>; + enum-name = "GPIO_SYS_RESET_L"; + }; + gpio_pg_ec_rsmrst_odl: pg_ec_rsmrst_odl { + gpios = <&gpioe 2 GPIO_INPUT>; + enum-name = "GPIO_PG_EC_RSMRST_ODL"; + }; + ec_pch_rsmrst_odl { + gpios = <&gpioa 6 GPIO_OUTPUT_LOW>; + enum-name = "GPIO_PCH_RSMRST_L"; + }; + gpio_pg_ec_all_sys_pwrgd: pg_ec_all_sys_pwrgd { + gpios = <&gpiof 4 GPIO_INPUT>; + enum-name = "GPIO_PG_EC_ALL_SYS_PWRGD"; + }; + gpio_slp_s0_l: slp_s0_l { + gpios = <&gpiod 5 GPIO_INPUT>; + enum-name = "GPIO_PCH_SLP_S0_L"; + }; + gpio_slp_s3_l: slp_s3_l { + gpios = <&gpioa 5 GPIO_INPUT>; + enum-name = "GPIO_PCH_SLP_S3_L"; + }; + vccst_pwrgd_od { + gpios = <&gpioa 4 GPIO_ODR_LOW>; + enum-name = "GPIO_VCCST_PWRGD_OD"; + }; + ec_prochot_odl { + gpios = <&gpio6 3 GPIO_ODR_HIGH>; + enum-name = "GPIO_CPU_PROCHOT"; + }; + ec_pch_pwr_btn_odl { + gpios = <&gpioc 1 GPIO_ODR_HIGH>; + enum-name = "GPIO_PCH_PWRBTN_L"; + }; + gpio_slp_sus_l: slp_sus_l { + gpios = <&gpiof 1 GPIO_INPUT>; + enum-name = "GPIO_SLP_SUS_L"; + }; + pch_pwrok { + gpios = <&gpio7 2 GPIO_OUTPUT_LOW>; + enum-name = "GPIO_PCH_PWROK"; + }; + ec_pch_sys_pwrok { + gpios = <&gpio3 7 GPIO_OUTPUT_LOW>; + enum-name = "GPIO_EC_PCH_SYS_PWROK"; + }; + imvp9_vrrdy_od { + gpios = <&gpio4 3 GPIO_INPUT>; + enum-name = "GPIO_IMVP9_VRRDY_OD"; + }; + ec_edp_bl_en { + gpios = <&gpiod 3 GPIO_OUTPUT_HIGH>; + enum-name = "GPIO_ENABLE_BACKLIGHT"; + }; + gpio_ec_prochot_in_l: ec_prochot_in_l { + gpios = <&gpiof 0 GPIO_INPUT>; + }; + gpio_en_pp5000_fan: en_pp5000_fan { + gpios = <&gpio6 1 GPIO_OUTPUT_HIGH>; + }; + gpio_ec_voldn_btn_odl: ec_voldn_btn_odl { + gpios = <&gpio9 3 GPIO_INPUT_PULL_UP>; + enum-name = "GPIO_VOLUME_DOWN_L"; + }; + gpio_ec_volup_btn_odl: ec_volup_btn_odl { + gpios = <&gpio9 7 GPIO_INPUT_PULL_UP>; + enum-name = "GPIO_VOLUME_UP_L"; + }; + gpio_usb_c0_c2_tcpc_int_odl: usb_c0_c2_tcpc_int_odl { + gpios = <&gpioe 0 GPIO_INPUT>; + enum-name = "GPIO_USB_C0_C2_TCPC_INT_ODL"; + }; + gpio_usb_c1_tcpc_int_odl: usb_c1_tcpc_int_odl { + gpios = <&gpioa 2 GPIO_INPUT>; + enum-name = "GPIO_USB_C1_TCPC_INT_ODL"; + }; + gpio_usb_c0_ppc_int_odl: usb_c0_ppc_int_odl { + gpios = <&gpio6 2 GPIO_INPUT>; + enum-name = "GPIO_USB_C0_PPC_INT_ODL"; + }; + gpio_usb_c1_ppc_int_odl: usb_c1_ppc_int_odl { + gpios = <&gpiof 5 GPIO_INPUT>; + enum-name = "GPIO_USB_C1_PPC_INT_ODL"; + }; + gpio_usb_c2_ppc_int_odl: usb_c2_ppc_int_odl { + gpios = <&gpio7 0 GPIO_INPUT>; + enum-name = "GPIO_USB_C2_PPC_INT_ODL"; + }; + gpio_usb_c0_bc12_int_odl: usb_c0_bc12_int_odl { + gpios = <&gpioc 6 GPIO_INPUT>; + enum-name = "GPIO_USB_C0_BC12_INT_ODL"; + }; + gpio_usb_c1_bc12_int_odl: usb_c1_bc12_int_odl { + gpios = <&gpio5 0 GPIO_INPUT>; + enum-name = "GPIO_USB_C1_BC12_INT_ODL"; + }; + gpio_usb_c2_bc12_int_odl: usb_c2_bc12_int_odl { + gpios = <&gpio8 3 GPIO_INPUT>; + enum-name = "GPIO_USB_C2_BC12_INT_ODL"; + }; + en_pp5000_usba_r { + gpios = <&gpiod 7 GPIO_OUTPUT_LOW>; + enum-name = "GPIO_EN_PP5000_USBA_R"; + }; + usb_c1_rt_rst_r_odl { + gpios = <&gpio0 2 GPIO_ODR_LOW>; + enum-name = "GPIO_USB_C1_RT_RST_R_ODL"; + }; + usb_c1_rst_odl { + gpios = <&gpio9 6 GPIO_ODR_LOW>; + enum-name = "GPIO_USB_C1_RST_ODL"; + }; + usb_c0_c2_tcpc_rst_odl { + gpios = <&gpioa 7 GPIO_ODR_LOW>; + enum-name = "GPIO_USB_C0_C2_TCPC_RST_ODL"; + }; + id_1_usb_c0_c2_tcpc_rst_odl { + gpios = <&gpio3 4 GPIO_ODR_LOW>; + }; + usb_c0_int_odl { + gpios = <&gpiob 1 GPIO_INPUT>; + }; + usb_c2_int_odl { + gpios = <&gpio4 1 GPIO_INPUT>; + }; + usb_c0_rt_int_odl: usb_c0_rt_int_odl { + gpios = <&gpiob 1 GPIO_INPUT>; + }; + usb_c2_rt_int_odl: usb_c2_rt_int_odl { + gpios = <&gpio4 1 GPIO_INPUT>; + }; + }; + + named-ioexes { + compatible = "named-ioexes"; + + usb_c0_oc_odl { + gpios = <&ioex_port1 4 GPIO_ODR_HIGH>; + enum-name = "IOEX_USB_C0_OC_ODL"; + label = "IOEX_USB_C0_OC_ODL"; + }; + usb_c0_frs_en { + gpios = <&ioex_port1 6 GPIO_OUTPUT_LOW>; + enum-name = "IOEX_USB_C0_FRS_EN"; + label = "IOEX_USB_C0_FRS_EN"; + }; + usb_c0_rt_rst_odl: usb_c0_rt_rst_odl { + gpios = <&ioex_port1 7 GPIO_ODR_HIGH>; + enum-name = "IOEX_USB_C0_RT_RST_ODL"; + label = "IOEX_USB_C0_RT_RST_ODL"; + }; + usb_c2_rt_rst_odl: usb_c2_rt_rst_odl { + gpios = <&ioex_port2 2 GPIO_ODR_HIGH>; + enum-name = "IOEX_USB_C2_RT_RST_ODL"; + label = "IOEX_USB_C2_RT_RST_ODL"; + }; + usb_c1_oc_odl { + gpios = <&ioex_port2 3 GPIO_ODR_HIGH>; + enum-name = "IOEX_USB_C1_OC_ODL"; + label = "IOEX_USB_C1_OC_ODL"; + }; + usb_c2_oc_odl { + gpios = <&ioex_port2 4 GPIO_ODR_HIGH>; + enum-name = "IOEX_USB_C2_OC_ODL"; + label = "IOEX_USB_C2_OC_ODL"; + }; + usb_c2_frs_en { + gpios = <&ioex_port2 6 GPIO_OUTPUT_LOW>; + enum-name = "IOEX_USB_C2_FRS_EN"; + label = "IOEX_USB_C2_FRS_EN"; + }; + }; + +}; + +&i2c1_0 { + status = "okay"; + + nct3808_0_P1:nct3808_0_P1@70 { + #address-cells = <1>; + #size-cells = <0>; + compatible = "nuvoton,nct38xx-gpio"; + reg = <0x70>; + label = "NCT3808_0_P1"; + + ioex_port1:gpio@0 { + compatible = "nuvoton,nct38xx-gpio-port"; + reg = <0x0>; + label = "NCT3808_0_P1_GPIO0"; + gpio-controller; + #gpio-cells = <2>; + ngpios = <8>; + pin_mask = <0xdc>; + pinmux_mask = <0xff>; + }; + }; + + nct3808_0_P2:nct3808_0_P2@74 { + #address-cells = <1>; + #size-cells = <0>; + compatible = "nuvoton,nct38xx-gpio"; + reg = <0x74>; + label = "NCT3808_0_P2"; + + ioex_port2:gpio@0 { + compatible = "nuvoton,nct38xx-gpio-port"; + reg = <0x0>; + label = "NCT3808_0_P2_GPIO0"; + gpio-controller; + #gpio-cells = <2>; + ngpios = <8>; + pin_mask = <0xdc>; + pinmux_mask = <0xff>; + }; + }; + + nct3808_alert_1 { + compatible = "nuvoton,nct38xx-gpio-alert"; + irq-gpios = <&gpioe 0 (GPIO_PULL_UP | GPIO_ACTIVE_LOW)>; + nct38xx-dev = <&nct3808_0_P1 &nct3808_0_P2>; + label = "NCT3808_ALERT_1"; + }; +}; diff --git a/zephyr/projects/brya/include/gpio_map.h b/zephyr/projects/brya/include/gpio_map.h new file mode 100644 index 0000000000..c8ed6773a2 --- /dev/null +++ b/zephyr/projects/brya/include/gpio_map.h @@ -0,0 +1,16 @@ +/* Copyright 2021 The Chromium OS Authors. All rights reserved. + * Use of this source code is governed by a BSD-style license that can be + * found in the LICENSE file. + */ + +#ifndef __ZEPHYR_GPIO_MAP_H +#define __ZEPHYR_GPIO_MAP_H + +#include +#include + +#define GPIO_ENTERING_RW GPIO_UNIMPLEMENTED + +#define GPIO_SEQ_EC_DSW_PWROK GPIO_PG_EC_DSW_PWROK + +#endif /* __ZEPHYR_GPIO_MAP_H */ diff --git a/zephyr/projects/brya/interrupts.dts b/zephyr/projects/brya/interrupts.dts new file mode 100644 index 0000000000..7132c12f77 --- /dev/null +++ b/zephyr/projects/brya/interrupts.dts @@ -0,0 +1,150 @@ +/* Copyright 2022 The Chromium OS Authors. All rights reserved. + * Use of this source code is governed by a BSD-style license that can be + * found in the LICENSE file. + */ + +/ { + aliases { + int-wp = &int_wp; + }; + + gpio-interrupts { + compatible = "cros-ec,gpio-interrupts"; + + int_tablet_mode: tablet_mode { + irq-pin = <&gpio_tablet_mode_l>; + flags = ; + handler = "gmr_tablet_switch_isr"; + }; + int_lid_open: lid_open { + irq-pin = <&lid_open>; + flags = ; + handler = "lid_interrupt"; + }; + int_power_button: power_button { + irq-pin = <&gsc_ec_pwr_btn_odl>; + flags = ; + handler = "power_button_interrupt"; + }; + int_wp: wp { + irq-pin = <&gpio_ec_wp_l>; + flags = ; + handler = "switch_interrupt"; + }; + int_ac_present: ac_present { + irq-pin = <&acok_od>; + flags = ; + handler = "extpower_interrupt"; + }; + int_volume_up: volume_up { + irq-pin = <&gpio_ec_volup_btn_odl>; + flags = ; + handler = "button_interrupt"; + }; + int_volume_down: volume_down { + irq-pin = <&gpio_ec_voldn_btn_odl>; + flags = ; + handler = "button_interrupt"; + }; + int_accel: accel { + irq-pin = <&gpio_ec_accel_int_l>; + flags = ; + handler = "lis2dw12_interrupt"; + }; + int_imu: imu { + irq-pin = <&gpio_ec_imu_int_l>; + flags = ; + handler = "lsm6dso_interrupt"; + }; + int_slp_s0: slp_s0 { + irq-pin = <&gpio_slp_s0_l>; + flags = ; + handler = "power_signal_interrupt"; + }; + int_slp_s3: slp_s3 { + irq-pin = <&gpio_slp_s3_l>; + flags = ; + handler = "power_signal_interrupt"; + }; + int_slp_sus: slp_sus { + irq-pin = <&gpio_slp_sus_l>; + flags = ; + handler = "power_signal_interrupt"; + }; + int_pg_dsw_pwrok: pg_dsw_pwrok { + irq-pin = <&gpio_pg_ec_dsw_pwrok>; + flags = ; + handler = "power_signal_interrupt"; + }; + int_pg_rsmrst_odl: pg_rsmrst_odl { + irq-pin = <&gpio_pg_ec_rsmrst_odl>; + flags = ; + handler = "power_signal_interrupt"; + }; + int_pg_all_sys_pwrgd: pg_all_sys_pwrgd { + irq-pin = <&gpio_pg_ec_all_sys_pwrgd>; + flags = ; + handler = "power_signal_interrupt"; + }; + int_als_rgb: als_rgb { + irq-pin = <&gpio_ec_als_rgb_int_l>; + flags = ; + handler = "tcs3400_interrupt"; + }; + int_prochot: prochot { + irq-pin = <&gpio_ec_prochot_in_l>; + flags = ; + handler = "throttle_ap_prochot_input_interrupt"; + }; + int_usb_c0_c2_tcpc: usb_c0_c2_tcpc { + irq-pin = <&gpio_usb_c0_c2_tcpc_int_odl>; + flags = ; + handler = "tcpc_alert_event"; + }; + int_usb_c1_tcpc: usb_c1_tcpc { + irq-pin = <&gpio_usb_c1_tcpc_int_odl>; + flags = ; + handler = "tcpc_alert_event"; + }; + int_usb_c0_ppc: usb_c0_ppc { + irq-pin = <&gpio_usb_c0_ppc_int_odl>; + flags = ; + handler = "ppc_interrupt"; + }; + int_usb_c1_ppc: usb_c1_ppc { + irq-pin = <&gpio_usb_c1_ppc_int_odl>; + flags = ; + handler = "ppc_interrupt"; + }; + int_usb_c2_ppc: usb_c2_ppc { + irq-pin = <&gpio_usb_c2_ppc_int_odl>; + flags = ; + handler = "ppc_interrupt"; + }; + int_usb_c0_bc12: usb_c0_bc12 { + irq-pin = <&gpio_usb_c0_bc12_int_odl>; + flags = ; + handler = "bc12_interrupt"; + }; + int_usb_c1_bc12: usb_c1_bc12 { + irq-pin = <&gpio_usb_c1_bc12_int_odl>; + flags = ; + handler = "bc12_interrupt"; + }; + int_usb_c2_bc12: usb_c2_bc12 { + irq-pin = <&gpio_usb_c2_bc12_int_odl>; + flags = ; + handler = "bc12_interrupt"; + }; + int_usb_c0_rt: usb_c0_rt { + irq-pin = <&usb_c0_rt_int_odl>; + flags = ; + handler = "retimer_interrupt"; + }; + int_usb_c2_rt: usb_c2_rt { + irq-pin = <&usb_c2_rt_int_odl>; + flags = ; + handler = "retimer_interrupt"; + }; + }; +}; diff --git a/zephyr/projects/brya/kblight_hooks.c b/zephyr/projects/brya/kblight_hooks.c new file mode 100644 index 0000000000..c56aeb5907 --- /dev/null +++ b/zephyr/projects/brya/kblight_hooks.c @@ -0,0 +1,67 @@ +/* Copyright 2022 The Chromium OS Authors. All rights reserved. + * Use of this source code is governed by a BSD-style license that can be + * found in the LICENSE file. + */ + +#include +#include + +#include +#include "cbi.h" +#include "hooks.h" + +/* Enable/Disable keyboard backlight gpio */ +static inline void kbd_backlight_enable(bool enable) +{ + if (get_board_id() == 1) + gpio_pin_set_dt(GPIO_DT_FROM_NODELABEL(gpio_id_1_ec_kb_bl_en), + enable); + else + gpio_pin_set_dt(GPIO_DT_FROM_NODELABEL(gpio_ec_kb_bl_en_l), + !enable); +} + +static void board_backlight_handler(struct ap_power_ev_callback *cb, + struct ap_power_ev_data data) +{ + bool enable; + + switch (data.event) { + default: + return; + + case AP_POWER_RESUME: + /* Called on AP S3 -> S0 transition */ + enable = true; + break; + + case AP_POWER_SUSPEND: + /* Called on AP S0 -> S3 transition */ + enable = false; + break; + } + kbd_backlight_enable(enable); +} + +/* + * Explicitly apply the board ID 1 *gpio.inc settings to pins that + * were reassigned on current boards. + */ +static void set_board_id_1_gpios(void) +{ + static struct ap_power_ev_callback cb; + + /* + * Add a callback for suspend/resume to + * control the keyboard backlight. + */ + ap_power_ev_init_callback(&cb, board_backlight_handler, + AP_POWER_RESUME | AP_POWER_SUSPEND); + ap_power_ev_add_callback(&cb); + + if (get_board_id() != 1) + return; + gpio_pin_configure_dt(GPIO_DT_FROM_NODELABEL(gpio_id_1_ec_kb_bl_en), + GPIO_OUTPUT_LOW); +} +DECLARE_HOOK(HOOK_INIT, set_board_id_1_gpios, HOOK_PRIO_FIRST); diff --git a/zephyr/projects/brya/keyboard.dts b/zephyr/projects/brya/keyboard.dts new file mode 100644 index 0000000000..fbcbeae63a --- /dev/null +++ b/zephyr/projects/brya/keyboard.dts @@ -0,0 +1,16 @@ +/* Copyright 2022 The Chromium OS Authors. All rights reserved. + * Use of this source code is governed by a BSD-style license that can be + * found in the LICENSE file. + */ + +/ { + kblight { + compatible = "cros-ec,kblight-pwm"; + pwms = <&pwm3 0 PWM_POLARITY_NORMAL>; + frequency = <2400>; + }; +}; + +&pwm3 { + status = "okay"; +}; diff --git a/zephyr/projects/brya/motionsense.dts b/zephyr/projects/brya/motionsense.dts new file mode 100644 index 0000000000..dd3f479042 --- /dev/null +++ b/zephyr/projects/brya/motionsense.dts @@ -0,0 +1,264 @@ +/* + * Copyright (c) 2022 The Chromium OS Authors + * + * SPDX-License-Identifier: Apache-2.0 + */ + +#include + + +/ { + aliases { + /* + * motion sense's <>_INT_EVENT is handled + * by alias. Using the alias, each driver creates + * its own <>_INT_EVENT. + */ + lsm6dso-int = &base_accel; + lis2dw12-int = &lid_accel; + tcs3400-int = &als_clear; + }; + + /* + * Declare mutexes used by sensor drivers. + * A mutex node is used to create an instance of mutex_t. + * A mutex node is referenced by a sensor node if the + * corresponding sensor driver needs to use the + * instance of the mutex. + */ + motionsense-mutex { + compatible = "cros-ec,motionsense-mutex"; + mutex_lis2dw12: lis2dw12-mutex { + label = "LIS2DW12_MUTEX"; + }; + + mutex_lsm6dso: lsm6dso-mutex { + label = "LSM6DSO_MUTEX"; + }; + }; + + /* Rotation matrix used by drivers. */ + motionsense-rotation-ref { + compatible = "cros-ec,motionsense-rotation-ref"; + lid_rot_ref: lid-rotation-ref { + mat33 = <0 1 0 + 1 0 0 + 0 0 (-1)>; + }; + base_rot_ref: base-rotation-ref { + mat33 = <1 0 0 + 0 (-1) 0 + 0 0 (-1)>; + }; + }; + + /* + * Driver specific data. A driver-specific data can be shared with + * different motion sensors while they are using the same driver. + * + * If a node's compatible starts with "cros-ec,accelgyro-", it is for + * a common structure defined in accelgyro.h. + * e.g) compatible = "cros-ec,accelgyro-als-drv-data" is for + * "struct als_drv_data_t" in accelgyro.h + */ + motionsense-sensor-data { + lis2dw12_data: lis2dw12-drv-data { + compatible = "cros-ec,drvdata-lis2dw12"; + status = "okay"; + }; + + lsm6dso_data: lsm6dso-drv-data { + compatible = "cros-ec,drvdata-lsm6dso"; + status = "okay"; + }; + + tcs_clear_data: tcs3400-clear-drv-data { + compatible = "cros-ec,drvdata-tcs3400-clear"; + status = "okay"; + + als-drv-data { + compatible = "cros-ec,accelgyro-als-drv-data"; + als-cal { + scale = <1>; + uscale = <0>; + offset = <0>; + als-channel-scale { + compatible = + "cros-ec,accelgyro-als-channel-scale"; + k-channel-scale = <1>; + cover-scale = <1>; + }; + }; + }; + }; + + tcs_rgb_data: tcs3400-rgb-drv-data { + compatible = "cros-ec,drvdata-tcs3400-rgb"; + status = "okay"; + + /* node for rgb_calibration_t defined in accelgyro.h */ + rgb_calibration { + compatible = + "cros-ec,accelgyro-rgb-calibration"; + + irt = <1>; + + rgb-cal-x { + offset = <0>; + coeff = <0 0 0 1>; + als-channel-scale { + compatible = + "cros-ec,accelgyro-als-channel-scale"; + k-channel-scale = <1>; + cover-scale = <1>; + }; + }; + rgb-cal-y { + offset = <0>; + coeff = <0 0 0 1>; + als-channel-scale { + compatible = + "cros-ec,accelgyro-als-channel-scale"; + k-channel-scale = <1>; + cover-scale = <1>; + }; + }; + rgb-cal-z { + offset = <0>; + coeff = <0 0 0 1>; + als-channel-scale { + compatible = + "cros-ec,accelgyro-als-channel-scale"; + k-channel-scale = <1>; + cover-scale = <1>; + }; + }; + }; + }; + }; + + /* + * List of motion sensors that creates motion_sensors array. + * The label "lid_accel" and "base_accel" are used to indicate + * motion sensor IDs for lid angle calculation. + */ + motionsense-sensor { + lid_accel: lid-accel { + compatible = "cros-ec,lis2dw12"; + status = "okay"; + + label = "Lid Accel"; + active-mask = "SENSOR_ACTIVE_S0_S3"; + location = "MOTIONSENSE_LOC_LID"; + mutex = <&mutex_lis2dw12>; + port = <&i2c_sensor>; + rot-standard-ref = <&lid_rot_ref>; + default-range = <2>; + drv-data = <&lis2dw12_data>; + i2c-spi-addr-flags = "LIS2DWL_ADDR0_FLAGS"; + configs { + compatible = + "cros-ec,motionsense-sensor-config"; + ec-s0 { + label = "SENSOR_CONFIG_EC_S0"; + odr = <(10000 | ROUND_UP_FLAG)>; + }; + ec-s3 { + label = "SENSOR_CONFIG_EC_S3"; + odr = <(10000 | ROUND_UP_FLAG)>; + }; + }; + }; + + base_accel: base-accel { + compatible = "cros-ec,lsm6dso-accel"; + status = "okay"; + + label = "Base Accel"; + active-mask = "SENSOR_ACTIVE_S0_S3"; + location = "MOTIONSENSE_LOC_BASE"; + mutex = <&mutex_lsm6dso>; + port = <&i2c_sensor>; + rot-standard-ref = <&base_rot_ref>; + default-range = <4>; + drv-data = <&lsm6dso_data>; + i2c-spi-addr-flags = "LSM6DSO_ADDR0_FLAGS"; + configs { + compatible = + "cros-ec,motionsense-sensor-config"; + ec-s0 { + label = "SENSOR_CONFIG_EC_S0"; + odr = <(13000 | ROUND_UP_FLAG)>; + ec-rate = <(100 * USEC_PER_MSEC)>; + }; + ec-s3 { + label = "SENSOR_CONFIG_EC_S3"; + odr = <(10000 | ROUND_UP_FLAG)>; + ec-rate = <(100 * USEC_PER_MSEC)>; + }; + }; + }; + + base-gyro { + compatible = "cros-ec,lsm6dso-gyro"; + status = "okay"; + + label = "Base Gyro"; + active-mask = "SENSOR_ACTIVE_S0_S3"; + location = "MOTIONSENSE_LOC_BASE"; + mutex = <&mutex_lsm6dso>; + port = <&i2c_sensor>; + rot-standard-ref = <&base_rot_ref>; + default-range = <(1000 | ROUND_UP_FLAG)>; /* dps */ + drv-data = <&lsm6dso_data>; + i2c-spi-addr-flags = "LSM6DSO_ADDR0_FLAGS"; + }; + + als_clear: base-als-clear { + compatible = "cros-ec,tcs3400-clear"; + status = "okay"; + + label = "Clear Light"; + active-mask = "SENSOR_ACTIVE_S0_S3"; + location = "MOTIONSENSE_LOC_CAMERA"; + port = <&i2c_sensor>; + default-range = <0x10000>; + drv-data = <&tcs_clear_data>; + i2c-spi-addr-flags = "TCS3400_I2C_ADDR_FLAGS"; + configs { + compatible = + "cros-ec,motionsense-sensor-config"; + ec-s0 { + /* Run ALS sensor in S0 */ + label = "SENSOR_CONFIG_EC_S0"; + odr = <1000>; + }; + }; + }; + + base-als-rgb { + compatible = "cros-ec,tcs3400-rgb"; + status = "okay"; + + label = "RGB Light"; + active-mask = "SENSOR_ACTIVE_S0_S3"; + location = "MOTIONSENSE_LOC_CAMERA"; + default-range = <0x10000>; /* scale = 1x, uscale = 0 */ + drv-data = <&tcs_rgb_data>; + }; + }; + + motionsense-sensor-info { + compatible = "cros-ec,motionsense-sensor-info"; + + /* list of entries for motion_als_sensors */ + als-sensors = <&als_clear>; + /* + * list of GPIO interrupts that have to + * be enabled at initial stage + */ + sensor-irqs = <&int_imu &int_als_rgb &int_accel>; + /* list of sensors in force mode */ + accel-force-mode-sensors = <&lid_accel &als_clear>; + }; +}; diff --git a/zephyr/projects/brya/prj.conf b/zephyr/projects/brya/prj.conf new file mode 100644 index 0000000000..abe72aa3a1 --- /dev/null +++ b/zephyr/projects/brya/prj.conf @@ -0,0 +1,208 @@ +# Copyright 2021 The Chromium OS Authors. All rights reserved. +# Use of this source code is governed by a BSD-style license that can be +# found in the LICENSE file. + +CONFIG_CROS_EC=y +CONFIG_PLATFORM_EC=y +CONFIG_SHIMMED_TASKS=y +CONFIG_PLATFORM_EC_POWER_BUTTON=y +CONFIG_PLATFORM_EC_LID_SWITCH=y +CONFIG_PLATFORM_EC_SWITCH=y +CONFIG_LTO=y +CONFIG_CROS_FLASH_NPCX=y +CONFIG_CROS_SYSTEM_NPCX=y +CONFIG_PLATFORM_EC_VBOOT_EFS2=y +CONFIG_PLATFORM_EC_VBOOT_HASH=y +CONFIG_PLATFORM_EC_EXTPOWER_GPIO=y +CONFIG_PLATFORM_EC_CONSOLE_CMD_SYSINFO=y +CONFIG_PLATFORM_EC_I2C=y + +CONFIG_PLATFORM_EC_ADC_CHANNELS_RUNTIME_CONFIG=y + +# SoC configuration +CONFIG_AP=y +CONFIG_AP_X86_INTEL_ADL=y +CONFIG_FPU=y +CONFIG_ARM_MPU=y + +# CBI +CONFIG_EEPROM=y +CONFIG_EEPROM_AT24=y +CONFIG_EEPROM_SHELL=n +CONFIG_PLATFORM_EC_CBI_EEPROM=y +CONFIG_PLATFORM_EC_BOARD_VERSION_CBI=y + +# eSPI +CONFIG_ESPI=y +CONFIG_PLATFORM_EC_ESPI_VW_SLP_S4=y +CONFIG_PLATFORM_EC_ESPI_VW_SLP_S5=y + +# Power Sequencing +CONFIG_PLATFORM_EC_POWERSEQ=y +CONFIG_PLATFORM_EC_POWERSEQ_RTC_RESET=y +CONFIG_PLATFORM_EC_POWERSEQ_S0IX=y +CONFIG_PLATFORM_EC_POWERSEQ_S4=y +CONFIG_PLATFORM_EC_POWER_SLEEP_FAILURE_DETECTION=y +CONFIG_PLATFORM_EC_THROTTLE_AP=y + +# Host command +CONFIG_PLATFORM_EC_HOSTCMD=y +CONFIG_PLATFORM_EC_HOSTCMD_AP_RESET=y + +# Console command +CONFIG_PLATFORM_EC_CONSOLE_CMD_ACCELS=y +CONFIG_PLATFORM_EC_CONSOLE_CMD_ACCEL_INFO=y +CONFIG_PLATFORM_EC_CONSOLE_CMD_I2C_SPEED=y + +# Sensors +CONFIG_PLATFORM_EC_MOTIONSENSE=y +CONFIG_PLATFORM_EC_ACCEL_FIFO=y +CONFIG_PLATFORM_EC_ACCEL_INTERRUPTS=y +CONFIG_PLATFORM_EC_ALS=y +CONFIG_PLATFORM_EC_DYNAMIC_MOTION_SENSOR_COUNT=y +CONFIG_PLATFORM_EC_GMR_TABLET_MODE=y +CONFIG_PLATFORM_EC_LID_ANGLE=y +CONFIG_PLATFORM_EC_LID_ANGLE_UPDATE=y +CONFIG_PLATFORM_EC_SENSOR_TIGHT_TIMESTAMPS=y +CONFIG_PLATFORM_EC_TABLET_MODE=y +CONFIG_PLATFORM_EC_TABLET_MODE_SWITCH=y + +# Sensor Drivers +CONFIG_PLATFORM_EC_ACCELGYRO_LSM6DSO=y +CONFIG_PLATFORM_EC_ACCEL_LIS2DW12=y +CONFIG_PLATFORM_EC_ACCEL_LIS2DW12_AS_BASE=y +CONFIG_PLATFORM_EC_ALS_TCS3400=y + +# Fan +CONFIG_PLATFORM_EC_FAN=y +CONFIG_SENSOR=y +CONFIG_SENSOR_SHELL=n +CONFIG_TACH_NPCX=y + +# Temperature sensors +CONFIG_PLATFORM_EC_TEMP_SENSOR=y +CONFIG_PLATFORM_EC_THERMISTOR=y + +# Miscellaneous configs +CONFIG_PLATFORM_EC_HIBERNATE_PSL=y + +# MKBP event +CONFIG_PLATFORM_EC_MKBP_EVENT=y +CONFIG_PLATFORM_EC_MKBP_INPUT_DEVICES=y +CONFIG_PLATFORM_EC_MKBP_USE_HOST_EVENT=y + +# MKBP event mask +CONFIG_PLATFORM_EC_MKBP_EVENT_WAKEUP_MASK=y +CONFIG_PLATFORM_EC_MKBP_HOST_EVENT_WAKEUP_MASK=y + +# PMIC +CONFIG_PLATFORM_EC_PMIC=y +CONFIG_PLATFORM_EC_MP2964=y + +# Keyboard +CONFIG_PLATFORM_EC_KEYBOARD=y +CONFIG_PLATFORM_EC_KEYBOARD_PROTOCOL_8042=y +CONFIG_PLATFORM_EC_KEYBOARD_COL2_INVERTED=y +CONFIG_PLATFORM_EC_KEYBOARD_KEYPAD=y +CONFIG_PLATFORM_EC_KEYBOARD_PWRBTN_ASSERTS_KSI3=y +CONFIG_PLATFORM_EC_VOLUME_BUTTONS=y +CONFIG_PLATFORM_EC_CMD_BUTTON=n +CONFIG_CROS_KB_RAW_NPCX=y + +# Keyboard Backlight +CONFIG_PLATFORM_EC_PWM_KBLIGHT=y + +CONFIG_PLATFORM_EC_WORKAROUND_FLASH_DOWNLOAD_API=y + +# Battery +CONFIG_PLATFORM_EC_BATTERY=y +CONFIG_PLATFORM_EC_BATTERY_SMART=y +CONFIG_PLATFORM_EC_BATTERY_FUEL_GAUGE=y +CONFIG_PLATFORM_EC_BATTERY_CUT_OFF=y +CONFIG_PLATFORM_EC_BATTERY_HW_PRESENT_CUSTOM=y +CONFIG_PLATFORM_EC_BATTERY_REVIVE_DISCONNECT=y + +# USB-C and charging +CONFIG_PLATFORM_EC_CHARGER_BQ25720=y +CONFIG_PLATFORM_EC_CHARGER_BQ25720_VSYS_TH2_CUSTOM=y +CONFIG_PLATFORM_EC_CHARGER_BQ25720_VSYS_TH2_DV=70 +CONFIG_PLATFORM_EC_CHARGER_DISCHARGE_ON_AC=y +CONFIG_PLATFORM_EC_CHARGER_DISCHARGE_ON_AC_CHARGER=y +CONFIG_PLATFORM_EC_CHARGER_MIN_BAT_PCT_FOR_POWER_ON=3 +CONFIG_PLATFORM_EC_CHARGER_MIN_BAT_PCT_FOR_POWER_ON_WITH_AC=1 +CONFIG_PLATFORM_EC_CHARGER_MIN_POWER_MW_FOR_POWER_ON_WITH_BATT=15000 +CONFIG_PLATFORM_EC_CHARGER_MIN_POWER_MW_FOR_POWER_ON=15001 +CONFIG_PLATFORM_EC_CHARGER_SENSE_RESISTOR=10 +CONFIG_PLATFORM_EC_CHARGER_SENSE_RESISTOR_AC=10 +CONFIG_PLATFORM_EC_CHARGE_RAMP_SW=y +CONFIG_PLATFORM_EC_BC12_DETECT_PI3USB9201=y +CONFIG_PLATFORM_EC_USB_PID=0x504F +CONFIG_PLATFORM_EC_USBC_PPC_SYV682X=y +CONFIG_PLATFORM_EC_USBC_PPC_NX20P3483=y +CONFIG_PLATFORM_EC_USBC_RETIMER_INTEL_BB=y +CONFIG_PLATFORM_EC_USB_DRP_ACC_TRYSRC=y +CONFIG_PLATFORM_EC_USB_MUX_VIRTUAL=y +CONFIG_PLATFORM_EC_USB_MUX_RUNTIME_CONFIG=n +CONFIG_PLATFORM_EC_USB_PD_DEBUG_FIXED_LEVEL=y +CONFIG_PLATFORM_EC_USB_PD_DEBUG_LEVEL=2 +CONFIG_PLATFORM_EC_USB_PD_ALT_MODE_UFP=y +CONFIG_PLATFORM_EC_USB_PD_VBUS_MEASURE_CHARGER=y +CONFIG_PLATFORM_EC_USB_PD_DISCHARGE_PPC=y +CONFIG_PLATFORM_EC_USB_PD_PPC=y +CONFIG_PLATFORM_EC_USB_PD_REV30=y +CONFIG_PLATFORM_EC_USB_PD_VBUS_DETECT_TCPC=y +CONFIG_PLATFORM_EC_USB_PD_TCPM_PS8815=y +CONFIG_PLATFORM_EC_USB_PD_TCPM_RT1715=n +CONFIG_PLATFORM_EC_USB_PD_TCPM_TUSB422=n +CONFIG_PLATFORM_EC_USB_PD_TCPM_NCT38XX=y +CONFIG_PLATFORM_EC_USB_PD_TCPM_MUX=y +CONFIG_PLATFORM_EC_USB_PD_PORT_MAX_COUNT=3 +CONFIG_PLATFORM_EC_USB_PD_TCPM_TCPCI=y +CONFIG_PLATFORM_EC_USBC_PPC_DEDICATED_INT=y +CONFIG_PLATFORM_EC_USBA=y +CONFIG_PLATFORM_EC_USB_A_PORT_COUNT=1 +CONFIG_PLATFORM_EC_USB_PORT_POWER_DUMB=y +CONFIG_PLATFORM_EC_CONSOLE_CMD_PPC_DUMP=n +CONFIG_PLATFORM_EC_CONSOLE_CMD_TCPC_DUMP=n +CONFIG_PLATFORM_EC_USB_PD_TCPC_RUNTIME_CONFIG=n +CONFIG_PLATFORM_EC_USB_PD_REQUIRE_AP_MODE_ENTRY=y +CONFIG_PLATFORM_EC_USB_PD_INT_SHARED=y +CONFIG_PLATFORM_EC_USB_PD_PORT_0_SHARED=y +CONFIG_PLATFORM_EC_USB_PD_PORT_2_SHARED=y + +CONFIG_SYSCON=y + +# LED +CONFIG_PLATFORM_EC_LED_COMMON=y +CONFIG_PLATFORM_EC_LED_PWM=y +CONFIG_PLATFORM_EC_CONSOLE_CMD_LEDTEST=n +CONFIG_PLATFORM_EC_LED_PWM_NEAR_FULL_COLOR=4 +CONFIG_PLATFORM_EC_LED_PWM_SOC_ON_COLOR=4 +CONFIG_PLATFORM_EC_LED_PWM_SOC_SUSPEND_COLOR=4 +CONFIG_PLATFORM_EC_LED_PWM_LOW_BATT_COLOR=5 + +# PWM +CONFIG_PWM=y +CONFIG_PWM_SHELL=n + +#IOEX +CONFIG_PLATFORM_EC_IOEX=y +CONFIG_PLATFORM_EC_CONSOLE_CMD_IOEX=y +CONFIG_GPIO_NCT38XX=y + +# TODO(b/188605676): bring these features up +CONFIG_PLATFORM_EC_BOARD_VERSION_GPIO=n + +# Power Sequencing +CONFIG_PLATFORM_EC_POWERSEQ=y +CONFIG_PLATFORM_EC_POWERSEQ_PP5000_CONTROL=n +CONFIG_CHIPSET_ALDERLAKE_SLG4BD44540=y +CONFIG_PLATFORM_EC_POWERSEQ_RTC_RESET=n +CONFIG_PLATFORM_EC_POWERSEQ_S0IX=y +CONFIG_PLATFORM_EC_POWER_SLEEP_FAILURE_DETECTION=y +# Treat 2nd reset from H1 as Power-On +CONFIG_PLATFORM_EC_BOARD_RESET_AFTER_POWER_ON=y +CONFIG_PLATFORM_EC_THROTTLE_AP=y + +# RTC +CONFIG_PLATFORM_EC_RTC=y diff --git a/zephyr/projects/brya/pwm_leds.dts b/zephyr/projects/brya/pwm_leds.dts new file mode 100644 index 0000000000..5d4a3992b5 --- /dev/null +++ b/zephyr/projects/brya/pwm_leds.dts @@ -0,0 +1,72 @@ +/* Copyright 2022 The Chromium OS Authors. All rights reserved. + * Use of this source code is governed by a BSD-style license that can be + * found in the LICENSE file. + */ + +/ { + pwmleds { + compatible = "pwm-leds"; + pwm_led0: pwm_led_0 { + pwms = <&pwm2 0 PWM_POLARITY_INVERTED + &pwm0 0 PWM_POLARITY_INVERTED>; + }; + pwm_led1: pwm_led_1 { + pwms = <&pwm1 0 PWM_POLARITY_INVERTED + &pwm7 0 PWM_POLARITY_INVERTED>; + }; + }; + + cros-pwmleds { + compatible = "cros-ec,pwm-leds"; + + leds = <&pwm_led0 &pwm_led1>; + frequency = <4800>; + + /**/ + color-map-red = <0 0>; + color-map-green = <0 0>; + color-map-blue = <0 0>; + color-map-yellow = <0 0>; + color-map-white = <0 50>; + color-map-amber = <50 0>; + + brightness-range = <0 0 0 0 100 100>; + + #address-cells = <1>; + #size-cells = <0>; + + pwm_led_0@0 { + reg = <0>; + ec-led-name = "EC_LED_ID_LEFT_LED"; + }; + + pwm_led_1@1 { + reg = <1>; + ec-led-name = "EC_LED_ID_RIGHT_LED"; + }; + }; +}; + +/* LED2 */ +&pwm0 { + status = "okay"; + clock-bus = "NPCX_CLOCK_BUS_LFCLK"; +}; + +/* LED3 */ +&pwm1 { + status = "okay"; + clock-bus = "NPCX_CLOCK_BUS_LFCLK"; +}; + +/* LED1 */ +&pwm2 { + status = "okay"; + clock-bus = "NPCX_CLOCK_BUS_LFCLK"; +}; + +/* LED4 */ +&pwm7 { + status = "okay"; + clock-bus = "NPCX_CLOCK_BUS_LFCLK"; +}; diff --git a/zephyr/projects/brya/usbc.dts b/zephyr/projects/brya/usbc.dts new file mode 100644 index 0000000000..e4458b8fb6 --- /dev/null +++ b/zephyr/projects/brya/usbc.dts @@ -0,0 +1,52 @@ +/* Copyright 2022 The Chromium OS Authors. All rights reserved. + * Use of this source code is governed by a BSD-style license that can be + * found in the LICENSE file. + */ + +/ { + usbc { + compatible = "named-usbc-ports"; + #address-cells = <1>; + #size-cells = <0>; + port0: usbc-port0@0 { + reg = <0>; + bc12 { + compatible = "pericom,pi3usb9201"; + status = "okay"; + irq = <&int_usb_c0_bc12>; + port = <&c0_c2_bc12>; + i2c-addr-flags = "PI3USB9201_I2C_ADDR_3_FLAGS"; + }; + tcpc { + compatible = "nuvoton,nct38xx"; + gpio-dev = <&nct3808_0_P1>; + }; + }; + + port1: usbc-port1@1 { + reg = <1>; + bc12 { + compatible = "pericom,pi3usb9201"; + status = "okay"; + irq = <&int_usb_c1_bc12>; + port = <&c1_bc12>; + i2c-addr-flags = "PI3USB9201_I2C_ADDR_3_FLAGS"; + }; + }; + + port2: usbc-port2@2 { + reg = <2>; + bc12 { + compatible = "pericom,pi3usb9201"; + status = "okay"; + irq = <&int_usb_c2_bc12>; + port = <&c0_c2_bc12>; + i2c-addr-flags = "PI3USB9201_I2C_ADDR_1_FLAGS"; + }; + tcpc { + compatible = "nuvoton,nct38xx"; + gpio-dev = <&nct3808_0_P2>; + }; + }; + }; +}; -- cgit v1.2.1