diff options
Diffstat (limited to 'zephyr/projects/herobrine')
53 files changed, 1282 insertions, 434 deletions
diff --git a/zephyr/projects/herobrine/BUILD.py b/zephyr/projects/herobrine/BUILD.py index 2a15441c55..b8bbdb0ce7 100644 --- a/zephyr/projects/herobrine/BUILD.py +++ b/zephyr/projects/herobrine/BUILD.py @@ -1,11 +1,13 @@ -# Copyright 2021 The Chromium OS Authors. All rights reserved. +# Copyright 2021 The ChromiumOS Authors # Use of this source code is governed by a BSD-style license that can be # found in the LICENSE file. """Define zmake projects for herobrine.""" -def register_variant(project_name, extra_dts_overlays=(), extra_kconfig_files=()): +def register_variant( + project_name, extra_dts_overlays=(), extra_kconfig_files=() +): """Register a variant of herobrine.""" register_npcx_project( project_name=project_name, @@ -14,7 +16,6 @@ def register_variant(project_name, extra_dts_overlays=(), extra_kconfig_files=() # Common to all projects. here / "adc.dts", here / "common.dts", - here / "i2c.dts", here / "interrupts.dts", here / "keyboard.dts", here / "default_gpio_pinctrl.dts", @@ -31,11 +32,28 @@ def register_variant(project_name, extra_dts_overlays=(), extra_kconfig_files=() register_variant( + project_name="evoker", + extra_dts_overlays=[ + here / "display.dts", + here / "battery_evoker.dts", + here / "gpio_evoker.dts", + here / "i2c_evoker.dts", + here / "led_pins_evoker.dts", + here / "led_policy_evoker.dts", + here / "motionsense_evoker.dts", + here / "switchcap.dts", + here / "usbc_evoker.dts", + ], + extra_kconfig_files=[here / "prj_evoker.conf"], +) + +register_variant( project_name="herobrine", extra_dts_overlays=[ here / "display.dts", here / "battery_herobrine.dts", here / "gpio.dts", + here / "i2c_herobrine.dts", here / "led_pins_herobrine.dts", here / "led_policy_herobrine.dts", here / "motionsense.dts", @@ -45,12 +63,12 @@ register_variant( extra_kconfig_files=[here / "prj_herobrine.conf"], ) - register_variant( project_name="hoglin", extra_dts_overlays=[ here / "battery_hoglin.dts", here / "gpio_hoglin.dts", + here / "i2c_hoglin.dts", here / "led_pins_hoglin.dts", here / "led_policy_hoglin.dts", here / "motionsense_hoglin.dts", @@ -60,12 +78,12 @@ register_variant( extra_kconfig_files=[here / "prj_hoglin.conf"], ) - register_variant( project_name="villager", extra_dts_overlays=[ here / "battery_villager.dts", here / "gpio_villager.dts", + here / "i2c_villager.dts", here / "led_pins_villager.dts", here / "led_policy_villager.dts", here / "motionsense_villager.dts", @@ -74,3 +92,18 @@ register_variant( ], extra_kconfig_files=[here / "prj_villager.conf"], ) + +register_variant( + project_name="zoglin", + extra_dts_overlays=[ + here / "battery_hoglin.dts", + here / "gpio_hoglin.dts", + here / "i2c_hoglin.dts", + here / "led_pins_hoglin.dts", + here / "led_policy_hoglin.dts", + here / "motionsense_hoglin.dts", + here / "switchcap_hoglin.dts", + here / "usbc_hoglin.dts", + ], + extra_kconfig_files=[here / "prj_zoglin.conf"], +) diff --git a/zephyr/projects/herobrine/CMakeLists.txt b/zephyr/projects/herobrine/CMakeLists.txt index 537fa5ef68..75aae3419e 100644 --- a/zephyr/projects/herobrine/CMakeLists.txt +++ b/zephyr/projects/herobrine/CMakeLists.txt @@ -1,13 +1,18 @@ -# Copyright 2021 The Chromium OS Authors. All rights reserved. +# Copyright 2021 The ChromiumOS Authors # 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}) +find_package(Zephyr REQUIRED HINTS "${ZEPHYR_BASE}") cros_ec_library_include_directories(include) +# Common Herobrine implementation +zephyr_library_sources( + "src/board_chipset.c" +) + # Board specific implementation zephyr_library_sources_ifdef(CONFIG_PLATFORM_EC_USBC "src/usbc_config.c" @@ -15,7 +20,9 @@ zephyr_library_sources_ifdef(CONFIG_PLATFORM_EC_USBC zephyr_library_sources_ifdef(CONFIG_PLATFORM_EC_I2C "src/i2c.c") -if(DEFINED CONFIG_BOARD_HEROBRINE) +if(DEFINED CONFIG_BOARD_EVOKER) + project(evoker) +elseif(DEFINED CONFIG_BOARD_HEROBRINE) project(herobrine) zephyr_library_sources_ifdef(CONFIG_PLATFORM_EC_USBC "src/herobrine/alt_dev_replacement.c") @@ -23,4 +30,6 @@ elseif(DEFINED CONFIG_BOARD_HOGLIN) project(hoglin) elseif(DEFINED CONFIG_BOARD_VILLAGER) project(villager) +elseif(DEFINED CONFIG_BOARD_ZOGLIN) + project(zoglin) endif() diff --git a/zephyr/projects/herobrine/Kconfig b/zephyr/projects/herobrine/Kconfig index 902e81a49a..383d5a08ee 100644 --- a/zephyr/projects/herobrine/Kconfig +++ b/zephyr/projects/herobrine/Kconfig @@ -1,7 +1,13 @@ -# Copyright 2022 The Chromium OS Authors. All rights reserved. +# Copyright 2022 The ChromiumOS Authors # Use of this source code is governed by a BSD-style license that can be # found in the LICENSE file. +config BOARD_EVOKER + bool "Evoker Board" + help + Build the Evoker board. The board is based on the Herobrine + reference design. + config BOARD_HEROBRINE bool "Google Herobrine Baseboard" help @@ -20,4 +26,10 @@ config BOARD_VILLAGER Build the Villager board. The board is based on the Herobrine reference design. +config BOARD_ZOGLIN + bool "Qualcomm Zoglin Baseboard" + help + Build Qualcomm Zoglin reference board. The board uses Nuvoton + NPCX9 chip as the EC. + source "Kconfig.zephyr" diff --git a/zephyr/projects/herobrine/adc.dts b/zephyr/projects/herobrine/adc.dts index bbb50cccab..16a5434e9d 100644 --- a/zephyr/projects/herobrine/adc.dts +++ b/zephyr/projects/herobrine/adc.dts @@ -1,4 +1,4 @@ -/* Copyright 2022 The Chromium OS Authors. All rights reserved. +/* Copyright 2022 The ChromiumOS Authors * Use of this source code is governed by a BSD-style license that can be * found in the LICENSE file. */ @@ -10,14 +10,12 @@ compatible = "named-adc-channels"; vbus { - label = "VBUS"; enum-name = "ADC_VBUS"; io-channels = <&adc0 1>; /* Measure VBUS through a 1/10 voltage divider */ mul = <10>; }; amon_bmon { - label = "AMON_BMON"; enum-name = "ADC_AMON_BMON"; io-channels = <&adc0 2>; /* @@ -29,7 +27,6 @@ div = <18>; }; psys { - label = "PSYS"; enum-name = "ADC_PSYS"; io-channels = <&adc0 3>; /* diff --git a/zephyr/projects/herobrine/battery_evoker.dts b/zephyr/projects/herobrine/battery_evoker.dts new file mode 100644 index 0000000000..0e09616c1d --- /dev/null +++ b/zephyr/projects/herobrine/battery_evoker.dts @@ -0,0 +1,15 @@ +/* Copyright 2022 The ChromiumOS Authors + * Use of this source code is governed by a BSD-style license that can be + * found in the LICENSE file. + */ + +/ { + batteries { + default_battery: pc_vp_bp153 { + compatible = "smp,pc-vp-bp153", "battery-smart"; + }; + ap16l5j { + compatible = "panasonic,ap16l5j", "battery-smart"; + }; + }; +}; diff --git a/zephyr/projects/herobrine/battery_herobrine.dts b/zephyr/projects/herobrine/battery_herobrine.dts index 764c3fb5ed..b347ec4c3c 100644 --- a/zephyr/projects/herobrine/battery_herobrine.dts +++ b/zephyr/projects/herobrine/battery_herobrine.dts @@ -1,4 +1,4 @@ -/* Copyright 2021 The Chromium OS Authors. All rights reserved. +/* Copyright 2021 The ChromiumOS Authors * Use of this source code is governed by a BSD-style license that can be * found in the LICENSE file. */ diff --git a/zephyr/projects/herobrine/battery_hoglin.dts b/zephyr/projects/herobrine/battery_hoglin.dts index 79fc6ca296..11180c3988 100644 --- a/zephyr/projects/herobrine/battery_hoglin.dts +++ b/zephyr/projects/herobrine/battery_hoglin.dts @@ -1,4 +1,4 @@ -/* Copyright 2022 The Chromium OS Authors. All rights reserved. +/* Copyright 2022 The ChromiumOS Authors * Use of this source code is governed by a BSD-style license that can be * found in the LICENSE file. */ diff --git a/zephyr/projects/herobrine/battery_villager.dts b/zephyr/projects/herobrine/battery_villager.dts index 2fe9a93774..dafd473a6e 100644 --- a/zephyr/projects/herobrine/battery_villager.dts +++ b/zephyr/projects/herobrine/battery_villager.dts @@ -1,4 +1,4 @@ -/* Copyright 2022 The Chromium OS Authors. All rights reserved. +/* Copyright 2022 The ChromiumOS Authors * Use of this source code is governed by a BSD-style license that can be * found in the LICENSE file. */ diff --git a/zephyr/projects/herobrine/common.dts b/zephyr/projects/herobrine/common.dts index aeb99c5377..a722f1dfa2 100644 --- a/zephyr/projects/herobrine/common.dts +++ b/zephyr/projects/herobrine/common.dts @@ -1,4 +1,4 @@ -/* Copyright 2022 The Chromium OS Authors. All rights reserved. +/* Copyright 2022 The ChromiumOS Authors * Use of this source code is governed by a BSD-style license that can be * found in the LICENSE file. */ diff --git a/zephyr/projects/herobrine/default_gpio_pinctrl.dts b/zephyr/projects/herobrine/default_gpio_pinctrl.dts index d25b388726..604658a145 100644 --- a/zephyr/projects/herobrine/default_gpio_pinctrl.dts +++ b/zephyr/projects/herobrine/default_gpio_pinctrl.dts @@ -1,44 +1,44 @@ -/* Copyright 2022 The Chromium OS Authors. All rights reserved. +/* Copyright 2022 The ChromiumOS Authors * Use of this source code is governed by a BSD-style license that can be * found in the LICENSE file. */ /* Adds the &alt1_no_lpc_espi setting over the NPCX9 default setting. */ &{/def-io-conf-list} { - pinctrl-0 = <&alt0_gpio_no_spip - &alt0_gpio_no_fpip - &alt1_no_pwrgd - &alt1_no_lpc_espi - &alta_no_peci_en - &altd_npsl_in1_sl - &altd_npsl_in2_sl - &altd_psl_in3_sl - &altd_psl_in4_sl - &alt7_no_ksi0_sl - &alt7_no_ksi1_sl - &alt7_no_ksi2_sl - &alt7_no_ksi3_sl - &alt7_no_ksi4_sl - &alt7_no_ksi5_sl - &alt7_no_ksi6_sl - &alt7_no_ksi7_sl - &alt8_no_kso00_sl - &alt8_no_kso01_sl - &alt8_no_kso02_sl - &alt8_no_kso03_sl - &alt8_no_kso04_sl - &alt8_no_kso05_sl - &alt8_no_kso06_sl - &alt8_no_kso07_sl - &alt9_no_kso08_sl - &alt9_no_kso09_sl - &alt9_no_kso10_sl - &alt9_no_kso11_sl - &alt9_no_kso12_sl - &alt9_no_kso13_sl - &alt9_no_kso14_sl - &alt9_no_kso15_sl - &alta_no_kso16_sl - &alta_no_kso17_sl - &altg_psl_gpo_sl>; + pinmux = <&alt0_gpio_no_spip + &alt0_gpio_no_fpip + &alt1_no_pwrgd + &alt1_no_lpc_espi + &alta_no_peci_en + &altd_npsl_in1_sl + &altd_npsl_in2_sl + &altd_psl_in3_sl + &altd_psl_in4_sl + &alt7_no_ksi0_sl + &alt7_no_ksi1_sl + &alt7_no_ksi2_sl + &alt7_no_ksi3_sl + &alt7_no_ksi4_sl + &alt7_no_ksi5_sl + &alt7_no_ksi6_sl + &alt7_no_ksi7_sl + &alt8_no_kso00_sl + &alt8_no_kso01_sl + &alt8_no_kso02_sl + &alt8_no_kso03_sl + &alt8_no_kso04_sl + &alt8_no_kso05_sl + &alt8_no_kso06_sl + &alt8_no_kso07_sl + &alt9_no_kso08_sl + &alt9_no_kso09_sl + &alt9_no_kso10_sl + &alt9_no_kso11_sl + &alt9_no_kso12_sl + &alt9_no_kso13_sl + &alt9_no_kso14_sl + &alt9_no_kso15_sl + &alta_no_kso16_sl + &alta_no_kso17_sl + &altg_psl_gpo_sl>; }; diff --git a/zephyr/projects/herobrine/display.dts b/zephyr/projects/herobrine/display.dts index 6f28e7e81a..65d3a2d91b 100644 --- a/zephyr/projects/herobrine/display.dts +++ b/zephyr/projects/herobrine/display.dts @@ -1,4 +1,4 @@ -/* Copyright 2022 The Chromium OS Authors. All rights reserved. +/* Copyright 2022 The ChromiumOS Authors * Use of this source code is governed by a BSD-style license that can be * found in the LICENSE file. */ @@ -7,7 +7,6 @@ displight { compatible = "cros-ec,displight"; pwms = <&pwm5 0 PWM_HZ(4800) PWM_POLARITY_NORMAL>; - frequency = <4800>; generic-pwm-channel = <1>; }; }; diff --git a/zephyr/projects/herobrine/gpio.dts b/zephyr/projects/herobrine/gpio.dts index ba958150e0..a355aaf099 100644 --- a/zephyr/projects/herobrine/gpio.dts +++ b/zephyr/projects/herobrine/gpio.dts @@ -1,4 +1,4 @@ -/* Copyright 2021 The Chromium OS Authors. All rights reserved. +/* Copyright 2021 The ChromiumOS Authors * Use of this source code is governed by a BSD-style license that can be * found in the LICENSE file. */ @@ -227,6 +227,12 @@ arm_x86 { gpios = <&gpio6 6 GPIO_OUTPUT_LOW>; }; + ec-i2c-sensor-scl { + gpios = <&gpiob 3 (GPIO_INPUT | GPIO_VOLTAGE_1P8)>; + }; + ec-i2c-sensor-sda { + gpios = <&gpiob 2 (GPIO_INPUT | GPIO_VOLTAGE_1P8)>; + }; gpio_ec_kso_02_inv: ec_kso_02_inv { gpios = <&gpio1 7 (GPIO_OUTPUT_LOW | GPIO_ACTIVE_LOW)>; }; @@ -237,20 +243,6 @@ enable-pins = <&gpio_en_usb_a_5v>; }; - def-lvol-io-list { - compatible = "nuvoton,npcx-lvolctrl-def"; - lvol-io-pads = < - &lvol_iob3 /* EC_I2C_SENSOR_SCL */ - &lvol_iob2 /* EC_I2C_SENSOR_SDA */ - >; - }; - - vsby-psl-in-list { - /* Use PSL_IN1/2/3/4 as detection pins from hibernate mode */ - psl-in-pads = <&psl_in1 &psl_in2 &psl_in3 &psl_in4>; - status = "okay"; - }; - sku { compatible = "cros-ec,gpio-id"; @@ -305,22 +297,33 @@ }; /* Power switch logic input pads */ -&psl_in1 { +&psl_in1_gpd2 { /* ACOK_OD */ - flag = <NPCX_PSL_RISING_EDGE>; + psl-in-mode = "edge"; + psl-in-pol = "high-rising"; }; -&psl_in2 { +&psl_in2_gp00 { /* EC_PWR_BTN_ODL */ - flag = <NPCX_PSL_FALLING_EDGE>; + psl-in-mode = "edge"; + psl-in-pol = "low-falling"; }; -&psl_in3 { +&psl_in3_gp01 { /* LID_OPEN_EC */ - flag = <NPCX_PSL_RISING_EDGE>; + psl-in-mode = "edge"; + psl-in-pol = "high-rising"; }; -&psl_in4 { +&psl_in4_gp02 { /* RTC_EC_WAKE_ODL */ - flag = <NPCX_PSL_FALLING_EDGE>; + psl-in-mode = "edge"; + psl-in-pol = "low-falling"; }; + +/* Power domain device controlled by PSL (Power Switch Logic) IO pads */ +&power_ctrl_psl { + status = "okay"; + pinctrl-names = "sleep"; + pinctrl-0 = <&psl_in1_gpd2 &psl_in2_gp00 &psl_in3_gp01 &psl_in4_gp02>; +};
\ No newline at end of file diff --git a/zephyr/projects/herobrine/gpio_evoker.dts b/zephyr/projects/herobrine/gpio_evoker.dts new file mode 100644 index 0000000000..c27cfba47d --- /dev/null +++ b/zephyr/projects/herobrine/gpio_evoker.dts @@ -0,0 +1,327 @@ +/* Copyright 2022 The ChromiumOS Authors + * 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_odl; + gpio-kbd-kso2 = &gpio_ec_kso_02_inv; + }; + + named-gpios { + compatible = "named-gpios"; + + gpio_usb_c0_pd_int_odl: usb_c0_pd_int_odl { + gpios = <&gpioe 0 GPIO_INPUT>; + enum-name = "GPIO_USB_C0_PD_INT_ODL"; + }; + gpio_usb_c1_pd_int_odl: usb_c1_pd_int_odl { + gpios = <&gpiof 5 GPIO_INPUT>; + enum-name = "GPIO_USB_C1_PD_INT_ODL"; + }; + gpio_usb_c0_swctl_int_odl: usb_c0_swctl_int_odl { + gpios = <&gpio0 3 GPIO_INPUT>; + enum-name = "GPIO_USB_C0_SWCTL_INT_ODL"; + }; + gpio_usb_c1_swctl_int_odl: usb_c1_swctl_int_odl { + gpios = <&gpio4 0 GPIO_INPUT>; + enum-name = "GPIO_USB_C1_SWCTL_INT_ODL"; + }; + gpio_usb_c0_bc12_int_l: usb_c0_bc12_int_l { + gpios = <&gpio6 1 GPIO_INPUT_PULL_UP>; + }; + gpio_usb_c1_bc12_int_l: usb_c1_bc12_int_l { + gpios = <&gpio8 2 GPIO_INPUT_PULL_UP>; + }; + gpio_usb_a0_oc_odl: usb_a0_oc_odl { + gpios = <&gpiof 4 GPIO_INPUT_PULL_UP>; + }; + gpio_chg_acok_od: chg_acok_od { + gpios = <&gpiod 2 GPIO_INPUT>; + enum-name = "GPIO_AC_PRESENT"; + }; + gpio_ec_pwr_btn_odl: ec_pwr_btn_odl { + gpios = <&gpio0 0 GPIO_INPUT>; + enum-name = "GPIO_POWER_BUTTON_L"; + }; + gpio_ec_voldn_btn_odl: ec_voldn_btn_odl { + gpios = <&gpio6 2 GPIO_INPUT_PULL_UP>; + enum-name = "GPIO_VOLUME_DOWN_L"; + }; + gpio_ec_volup_btn_odl: ec_volup_btn_odl { + gpios = <&gpioc 2 GPIO_INPUT_PULL_UP>; + enum-name = "GPIO_VOLUME_UP_L"; + }; + gpio_ec_wp_odl: ec_wp_odl { + gpios = <&gpiod 3 (GPIO_INPUT | GPIO_ACTIVE_LOW)>; + }; + gpio_lid_open_ec: lid_open_ec { + gpios = <&gpio0 1 GPIO_INPUT>; + enum-name = "GPIO_LID_OPEN"; + }; + gpio_ap_rst_l: ap_rst_l { + gpios = <&gpio5 1 GPIO_INPUT>; + enum-name = "GPIO_AP_RST_L"; + }; + gpio_ps_hold: ps_hold { + gpios = <&gpioa 6 GPIO_INPUT_PULL_DOWN>; + enum-name = "GPIO_PS_HOLD"; + }; + gpio_ap_suspend: ap_suspend { + gpios = <&gpio5 7 GPIO_INPUT>; + enum-name = "GPIO_AP_SUSPEND"; + }; + gpio_mb_power_good: mb_power_good { + gpios = <&gpio3 7 GPIO_INPUT_PULL_DOWN>; + enum-name = "GPIO_POWER_GOOD"; + }; + gpio_warm_reset_l: warm_reset_l { + gpios = <&gpiob 0 GPIO_INPUT>; + enum-name = "GPIO_WARM_RESET_L"; + }; + ap_ec_spi_cs_l { + gpios = <&gpio5 3 GPIO_INPUT_PULL_DOWN>; + }; + gpio_tablet_mode_l: tablet_mode_l { + gpios = <&gpioc 6 GPIO_INPUT>; + enum-name = "GPIO_TABLET_MODE_L"; + }; + gpio_accel_gyro_int_l: accel_gyro_int_l { + gpios = <&gpioa 3 GPIO_INPUT>; + }; + gpio_rtc_ec_wake_odl: rtc_ec_wake_odl { + gpios = <&gpio0 2 GPIO_INPUT>; + }; + ec_entering_rw { + gpios = <&gpio7 2 GPIO_OUTPUT_LOW>; + enum-name = "GPIO_ENTERING_RW"; + }; + ccd_mode_odl { + gpios = <&gpio6 3 GPIO_INPUT>; + enum-name = "GPIO_CCD_MODE_ODL"; + }; + ec_batt_pres_odl { + gpios = <&gpioe 5 GPIO_INPUT>; + enum-name = "GPIO_BATT_PRES_ODL"; + }; + ec_gsc_packet_mode { + gpios = <&gpio8 3 GPIO_OUTPUT_LOW>; + enum-name = "GPIO_PACKET_MODE_EN"; + }; + pmic_resin_l { + gpios = <&gpioa 0 GPIO_ODR_HIGH>; + enum-name = "GPIO_PMIC_RESIN_L"; + }; + pmic_kpd_pwr_odl { + gpios = <&gpioa 2 GPIO_ODR_HIGH>; + enum-name = "GPIO_PMIC_KPD_PWR_ODL"; + }; + ap_ec_int_l { + gpios = <&gpio5 6 GPIO_ODR_HIGH>; + enum-name = "GPIO_EC_INT_L"; + }; + gpio_switchcap_on: switchcap_on { + gpios = <&gpiod 5 GPIO_OUTPUT_LOW>; + enum-name = "GPIO_SWITCHCAP_ON"; + }; + gpio_en_pp5000_s5: en_pp5000_s5 { + gpios = <&gpio7 3 GPIO_OUTPUT_HIGH>; + enum-name = "GPIO_EN_PP5000"; + }; + ec_bl_disable_l { + /* Enable EC-controlled backlight; + * disable it initially. + */ + gpios = <&gpiob 6 GPIO_OUTPUT_LOW>; + enum-name = "GPIO_ENABLE_BACKLIGHT"; + }; + lid_accel_int_l { + gpios = <&gpioa 1 GPIO_INPUT>; + }; + tp_int_gate { + gpios = <&gpio7 4 GPIO_OUTPUT_LOW>; + }; + gpio_usb_c0_pd_rst_l: usb_c0_pd_rst_l { + gpios = <&gpiof 1 GPIO_OUTPUT_HIGH>; + }; + gpio_usb_c1_pd_rst_l: usb_c1_pd_rst_l { + gpios = <&gpioe 4 GPIO_OUTPUT_HIGH>; + }; + gpio_dp_mux_oe_l: dp_mux_oe_l { + gpios = <&gpiob 1 GPIO_ODR_HIGH>; + }; + gpio_dp_mux_sel: dp_mux_sel { + gpios = <&gpio4 5 GPIO_OUTPUT_LOW>; + }; + gpio_dp_hot_plug_det_r: dp_hot_plug_det_r { + gpios = <&gpio9 5 GPIO_OUTPUT_LOW>; + }; + gpio_en_usb_a_5v: en_usb_a_5v { + gpios = <&gpiof 0 GPIO_OUTPUT_LOW>; + enum-name = "GPIO_EN_USB_A_5V"; + }; + usb_a_cdp_ilim_en_l { + gpios = <&gpio7 5 GPIO_OUTPUT_HIGH>; + }; + gpio_usb_c0_frs_en: usb_c0_frs_en { + gpios = <&gpioc 5 GPIO_OUTPUT_LOW>; + enum-name = "GPIO_USB_C0_FRS_EN"; + }; + gpio_usb_c1_frs_en: usb_c1_frs_en { + gpios = <&gpioc 1 GPIO_OUTPUT_LOW>; + enum-name = "GPIO_USB_C1_FRS_EN"; + }; + gpio_ec_chg_led_y_c0: ec_chg_led_y_c0 { + #led-pin-cells = <1>; + gpios = <&gpio6 0 GPIO_OUTPUT_LOW>; + }; + gpio_ec_chg_led_w_c0: ec_chg_led_w_c0 { + #led-pin-cells = <1>; + gpios = <&gpioc 0 GPIO_OUTPUT_LOW>; + }; + gpio_ec_chg_led_w_c1: ec_chg_led_w_c1 { + #led-pin-cells = <1>; + gpios = <&gpioc 3 GPIO_OUTPUT_LOW>; + }; + gpio_ec_chg_led_r_c0: ec_chg_led_r_c0 { + #led-pin-cells = <1>; + gpios = <&gpioc 4 GPIO_OUTPUT_LOW>; + }; + ap_ec_spi_mosi { + gpios = <&gpio4 6 GPIO_INPUT_PULL_DOWN>; + }; + ap_ec_spi_miso { + gpios = <&gpio4 7 GPIO_INPUT_PULL_DOWN>; + }; + ap_ec_spi_clk { + gpios = <&gpio5 5 GPIO_INPUT_PULL_DOWN>; + }; + gpio_brd_id0: brd_id0 { + gpios = <&gpio9 4 GPIO_INPUT>; + enum-name = "GPIO_BOARD_VERSION1"; + }; + gpio_brd_id1: brd_id1 { + gpios = <&gpio9 7 GPIO_INPUT>; + enum-name = "GPIO_BOARD_VERSION2"; + }; + gpio_brd_id2: brd_id2 { + gpios = <&gpioa 5 GPIO_INPUT>; + enum-name = "GPIO_BOARD_VERSION3"; + }; + gpio_sku_id0: sku_id0 { + gpios = <&gpio6 7 GPIO_INPUT>; + }; + gpio_sku_id1: sku_id1 { + gpios = <&gpio7 0 GPIO_INPUT>; + }; + gpio_sku_id2: sku_id2 { + gpios = <&gpioe 1 GPIO_INPUT>; + }; + gpio_switchcap_pg: src_vph_pwr_pg { + gpios = <&gpioe 2 GPIO_INPUT_PULL_DOWN>; + enum-name = "GPIO_SWITCHCAP_PG"; + }; + arm_x86 { + gpios = <&gpio6 6 GPIO_OUTPUT_LOW>; + }; + ec-i2c-sensor-scl { + gpios = <&gpiob 3 (GPIO_INPUT | GPIO_VOLTAGE_1P8)>; + }; + ec-i2c-sensor-sda { + gpios = <&gpiob 2 (GPIO_INPUT | GPIO_VOLTAGE_1P8)>; + }; + gpio_ec_kso_02_inv: ec_kso_02_inv { + gpios = <&gpio1 7 (GPIO_OUTPUT_LOW | GPIO_ACTIVE_LOW)>; + }; + }; + + usba-port-enable-list { + compatible = "cros-ec,usba-port-enable-pins"; + enable-pins = <&gpio_en_usb_a_5v>; + }; + + sku { + compatible = "cros-ec,gpio-id"; + + bits = < + &gpio_sku_id0 + &gpio_sku_id1 + &gpio_sku_id2 + >; + + system = "ternary"; + }; + + board { + compatible = "cros-ec,gpio-id"; + + bits = < + &gpio_brd_id0 + &gpio_brd_id1 + &gpio_brd_id2 + >; + + system = "ternary"; + }; + + unused-pins { + compatible = "unused-gpios"; + unused-gpios = + <&gpio5 2 0>, + <&gpio5 4 0>, + <&gpio7 6 0>, + <&gpiod 1 0>, + <&gpiod 0 0>, + <&gpioe 3 0>, + <&gpio0 4 0>, + <&gpiod 6 0>, + <&gpio3 2 0>, + <&gpio3 5 0>, + <&gpiod 7 0>, + <&gpio8 6 0>, + <&gpiod 4 0>, + <&gpio4 1 0>, + <&gpio3 4 0>, + <&gpioc 7 0>, + <&gpioa 4 0>, + <&gpio9 6 0>, + <&gpio9 3 0>, + <&gpioa 7 0>, + <&gpio5 0 0>, + <&gpio8 1 0>, + <&gpiob 7 0>; + }; +}; + +/* Power switch logic input pads */ +&psl_in1_gpd2 { + /* ACOK_OD */ + psl-in-mode = "edge"; + psl-in-pol = "high-rising"; +}; + +&psl_in2_gp00 { + /* EC_PWR_BTN_ODL */ + psl-in-mode = "edge"; + psl-in-pol = "low-falling"; +}; + +&psl_in3_gp01 { + /* LID_OPEN_EC */ + psl-in-mode = "edge"; + psl-in-pol = "high-rising"; +}; + +&psl_in4_gp02 { + /* RTC_EC_WAKE_ODL */ + psl-in-mode = "edge"; + psl-in-pol = "low-falling"; +}; + +/* Power domain device controlled by PSL (Power Switch Logic) IO pads */ +&power_ctrl_psl { + status = "okay"; + pinctrl-names = "sleep"; + pinctrl-0 = <&psl_in1_gpd2 &psl_in2_gp00 &psl_in3_gp01 &psl_in4_gp02>; +}; diff --git a/zephyr/projects/herobrine/gpio_hoglin.dts b/zephyr/projects/herobrine/gpio_hoglin.dts index f0b8a43586..cb7babc9cf 100644 --- a/zephyr/projects/herobrine/gpio_hoglin.dts +++ b/zephyr/projects/herobrine/gpio_hoglin.dts @@ -1,4 +1,4 @@ -/* Copyright 2022 The Chromium OS Authors. All rights reserved. +/* Copyright 2022 The ChromiumOS Authors * Use of this source code is governed by a BSD-style license that can be * found in the LICENSE file. */ @@ -225,6 +225,12 @@ arm_x86 { gpios = <&gpio6 6 GPIO_OUTPUT_LOW>; }; + ec-i2c-sensor-scl { + gpios = <&gpiob 3 (GPIO_INPUT | GPIO_VOLTAGE_1P8)>; + }; + ec-i2c-sensor-sda { + gpios = <&gpiob 2 (GPIO_INPUT | GPIO_VOLTAGE_1P8)>; + }; gpio_ec_kso_02_inv: ec_kso_02_inv { gpios = <&gpio1 7 (GPIO_OUTPUT_LOW | GPIO_ACTIVE_LOW)>; }; @@ -235,20 +241,6 @@ enable-pins = <&gpio_en_usb_a_5v>; }; - def-lvol-io-list { - compatible = "nuvoton,npcx-lvolctrl-def"; - lvol-io-pads = < - &lvol_iob3 /* EC_I2C_SENSOR_SCL */ - &lvol_iob2 /* EC_I2C_SENSOR_SDA */ - >; - }; - - vsby-psl-in-list { - /* Use PSL_IN1/2/3/4 as detection pins from hibernate mode */ - psl-in-pads = <&psl_in1 &psl_in2 &psl_in3 &psl_in4>; - status = "okay"; - }; - sku { compatible = "cros-ec,gpio-id"; @@ -303,22 +295,33 @@ }; /* Power switch logic input pads */ -&psl_in1 { +&psl_in1_gpd2 { /* ACOK_OD */ - flag = <NPCX_PSL_RISING_EDGE>; + psl-in-mode = "edge"; + psl-in-pol = "high-rising"; }; -&psl_in2 { +&psl_in2_gp00 { /* EC_PWR_BTN_ODL */ - flag = <NPCX_PSL_FALLING_EDGE>; + psl-in-mode = "edge"; + psl-in-pol = "low-falling"; }; -&psl_in3 { +&psl_in3_gp01 { /* LID_OPEN_EC */ - flag = <NPCX_PSL_RISING_EDGE>; + psl-in-mode = "edge"; + psl-in-pol = "high-rising"; }; -&psl_in4 { +&psl_in4_gp02 { /* RTC_EC_WAKE_ODL */ - flag = <NPCX_PSL_FALLING_EDGE>; + psl-in-mode = "edge"; + psl-in-pol = "low-falling"; +}; + +/* Power domain device controlled by PSL (Power Switch Logic) IO pads */ +&power_ctrl_psl { + status = "okay"; + pinctrl-names = "sleep"; + pinctrl-0 = <&psl_in1_gpd2 &psl_in2_gp00 &psl_in3_gp01 &psl_in4_gp02>; }; diff --git a/zephyr/projects/herobrine/gpio_villager.dts b/zephyr/projects/herobrine/gpio_villager.dts index 7b8d2adcb5..1e7625ff6a 100644 --- a/zephyr/projects/herobrine/gpio_villager.dts +++ b/zephyr/projects/herobrine/gpio_villager.dts @@ -1,4 +1,4 @@ -/* Copyright 2021 The Chromium OS Authors. All rights reserved. +/* Copyright 2021 The ChromiumOS Authors * Use of this source code is governed by a BSD-style license that can be * found in the LICENSE file. */ @@ -219,6 +219,12 @@ arm_x86 { gpios = <&gpio6 6 GPIO_OUTPUT_LOW>; }; + ec-i2c-sensor-scl { + gpios = <&gpiob 3 (GPIO_INPUT | GPIO_VOLTAGE_1P8)>; + }; + ec-i2c-sensor-sda { + gpios = <&gpiob 2 (GPIO_INPUT | GPIO_VOLTAGE_1P8)>; + }; gpio_ec_kso_02_inv: ec_kso_02_inv { gpios = <&gpio1 7 (GPIO_OUTPUT_LOW | GPIO_ACTIVE_LOW)>; }; @@ -229,20 +235,6 @@ enable-pins = <&gpio_en_usb_a_5v>; }; - def-lvol-io-list { - compatible = "nuvoton,npcx-lvolctrl-def"; - lvol-io-pads = < - &lvol_iob3 /* EC_I2C_SENSOR_SCL */ - &lvol_iob2 /* EC_I2C_SENSOR_SDA */ - >; - }; - - vsby-psl-in-list { - /* Use PSL_IN1/2/3/4 as detection pins from hibernate mode */ - psl-in-pads = <&psl_in1 &psl_in2 &psl_in3 &psl_in4>; - status = "okay"; - }; - sku { compatible = "cros-ec,gpio-id"; @@ -299,22 +291,33 @@ }; /* Power switch logic input pads */ -&psl_in1 { +&psl_in1_gpd2 { /* ACOK_OD */ - flag = <NPCX_PSL_RISING_EDGE>; + psl-in-mode = "edge"; + psl-in-pol = "high-rising"; }; -&psl_in2 { +&psl_in2_gp00 { /* EC_PWR_BTN_ODL */ - flag = <NPCX_PSL_FALLING_EDGE>; + psl-in-mode = "edge"; + psl-in-pol = "low-falling"; }; -&psl_in3 { +&psl_in3_gp01 { /* LID_OPEN_EC */ - flag = <NPCX_PSL_RISING_EDGE>; + psl-in-mode = "edge"; + psl-in-pol = "high-rising"; }; -&psl_in4 { +&psl_in4_gp02 { /* RTC_EC_WAKE_ODL */ - flag = <NPCX_PSL_FALLING_EDGE>; + psl-in-mode = "edge"; + psl-in-pol = "low-falling"; +}; + +/* Power domain device controlled by PSL (Power Switch Logic) IO pads */ +&power_ctrl_psl { + status = "okay"; + pinctrl-names = "sleep"; + pinctrl-0 = <&psl_in1_gpd2 &psl_in2_gp00 &psl_in3_gp01 &psl_in4_gp02>; }; diff --git a/zephyr/projects/herobrine/i2c.dts b/zephyr/projects/herobrine/i2c_common.dtsi index 5aed893596..b1ed0242c0 100644 --- a/zephyr/projects/herobrine/i2c.dts +++ b/zephyr/projects/herobrine/i2c_common.dtsi @@ -1,4 +1,4 @@ -/* Copyright 2021 The Chromium OS Authors. All rights reserved. +/* Copyright 2022 The ChromiumOS Authors * Use of this source code is governed by a BSD-style license that can be * found in the LICENSE file. */ @@ -20,48 +20,33 @@ i2c_power: power { i2c-port = <&i2c0_0>; remote-port = <0>; - enum-name = "I2C_PORT_POWER"; - }; - battery { - i2c-port = <&i2c0_0>; - remote-port = <0>; - enum-name = "I2C_PORT_BATTERY"; - }; - virtual-battery { - i2c-port = <&i2c0_0>; - remote-port = <0>; - enum-name = "I2C_PORT_VIRTUAL_BATTERY"; - }; - i2c_charger: charger { - i2c-port = <&i2c0_0>; - remote-port = <0>; - enum-name = "I2C_PORT_CHARGER"; + enum-names = "I2C_PORT_POWER", + "I2C_PORT_BATTERY", + "I2C_PORT_VIRTUAL_BATTERY", + "I2C_PORT_CHARGER"; }; i2c_tcpc0: tcpc0 { i2c-port = <&i2c1_0>; dynamic-speed; - enum-name = "I2C_PORT_TCPC0"; + enum-names = "I2C_PORT_TCPC0"; }; i2c_tcpc1: tcpc1 { i2c-port = <&i2c2_0>; dynamic-speed; - enum-name = "I2C_PORT_TCPC1"; + enum-names = "I2C_PORT_TCPC1"; }; rtc { i2c-port = <&i2c4_1>; - enum-name = "I2C_PORT_RTC"; + enum-names = "I2C_PORT_RTC"; }; i2c_eeprom: eeprom { i2c-port = <&i2c5_0>; - enum-name = "I2C_PORT_EEPROM"; + enum-names = "I2C_PORT_EEPROM"; }; i2c_sensor: sensor { i2c-port = <&i2c7_0>; - enum-name = "I2C_PORT_SENSOR"; - }; - accel { - i2c-port = <&i2c7_0>; - enum-name = "I2C_PORT_ACCEL"; + enum-names = "I2C_PORT_SENSOR", + "I2C_PORT_ACCEL"; }; }; @@ -74,6 +59,19 @@ clock-frequency = <I2C_BITRATE_STANDARD>; pinctrl-0 = <&i2c0_0_sda_scl_gpb4_b5>; pinctrl-names = "default"; + + bc12_port0: pi3usb9201@5f { + compatible = "pericom,pi3usb9201"; + status = "okay"; + reg = <0x5f>; + irq = <&int_usb_c0_bc12>; + }; + + charger: isl923x@9 { + compatible = "intersil,isl923x"; + status = "okay"; + reg = <0x9>; + }; }; &i2c_ctrl0 { @@ -119,7 +117,6 @@ pcf85063a: pcf85063a@51 { compatible = "nxp,rtc-pcf85063a"; reg = <0x51>; - label = "RTC_PCF85063A"; int-pin = <&gpio_rtc_ec_wake_odl>; }; }; @@ -134,6 +131,13 @@ clock-frequency = <I2C_BITRATE_FAST>; pinctrl-0 = <&i2c5_0_sda_scl_gp33_36>; pinctrl-names = "default"; + + bc12_port1: pi3usb9201@5f { + compatible = "pericom,pi3usb9201"; + status = "okay"; + reg = <0x5f>; + irq = <&int_usb_c1_bc12>; + }; }; &i2c_ctrl5 { diff --git a/zephyr/projects/herobrine/i2c_evoker.dts b/zephyr/projects/herobrine/i2c_evoker.dts new file mode 100644 index 0000000000..7023d08c8d --- /dev/null +++ b/zephyr/projects/herobrine/i2c_evoker.dts @@ -0,0 +1,46 @@ +/* Copyright 2022 The ChromiumOS Authors + * Use of this source code is governed by a BSD-style license that can be + * found in the LICENSE file. + */ + +#include "i2c_common.dtsi" + +&i2c1_0 { + ppc_port0: syv682x@41 { + compatible = "silergy,syv682x"; + status = "okay"; + reg = <0x41>; + frs_en_gpio = <&gpio_usb_c0_frs_en>; + }; + + ppc_port0_alt: sn5s330@40 { + compatible = "ti,sn5s330"; + status = "okay"; + reg = <0x40>; + }; + + tcpc_port0: ps8xxx@b { + compatible = "parade,ps8xxx"; + reg = <0xb>; + }; +}; + +&i2c2_0 { + ppc_port1: syv682x@41 { + compatible = "silergy,syv682x"; + status = "okay"; + reg = <0x41>; + frs_en_gpio = <&gpio_usb_c1_frs_en>; + }; + + ppc_port1_alt: sn5s330@40 { + compatible = "ti,sn5s330"; + status = "okay"; + reg = <0x40>; + }; + + tcpc_port1: ps8xxx@b { + compatible = "parade,ps8xxx"; + reg = <0xb>; + }; +}; diff --git a/zephyr/projects/herobrine/i2c_herobrine.dts b/zephyr/projects/herobrine/i2c_herobrine.dts new file mode 100644 index 0000000000..92c68f4215 --- /dev/null +++ b/zephyr/projects/herobrine/i2c_herobrine.dts @@ -0,0 +1,39 @@ +/* Copyright 2022 The ChromiumOS Authors + * Use of this source code is governed by a BSD-style license that can be + * found in the LICENSE file. + */ + +#include "i2c_common.dtsi" + +&i2c1_0 { + ppc_port0: sn5s330@40 { + compatible = "ti,sn5s330"; + status = "okay"; + reg = <0x40>; + }; + + ppc_port0_alt: syv682x@41 { + compatible = "silergy,syv682x"; + status = "okay"; + reg = <0x41>; + frs_en_gpio = <&gpio_usb_c0_frs_en>; + }; + + tcpc_port0: ps8xxx@b { + compatible = "parade,ps8xxx"; + reg = <0xb>; + }; +}; + +&i2c2_0 { + ppc_port1: sn5s330@40 { + compatible = "ti,sn5s330"; + status = "okay"; + reg = <0x40>; + }; + + tcpc_port1: ps8xxx@b { + compatible = "parade,ps8xxx"; + reg = <0xb>; + }; +}; diff --git a/zephyr/projects/herobrine/i2c_hoglin.dts b/zephyr/projects/herobrine/i2c_hoglin.dts new file mode 100644 index 0000000000..504dbb9248 --- /dev/null +++ b/zephyr/projects/herobrine/i2c_hoglin.dts @@ -0,0 +1,34 @@ +/* Copyright 2022 The ChromiumOS Authors + * Use of this source code is governed by a BSD-style license that can be + * found in the LICENSE file. + */ + +#include "i2c_common.dtsi" + +&i2c1_0 { + ppc_port0: syv682x@41 { + compatible = "silergy,syv682x"; + status = "okay"; + reg = <0x41>; + frs_en_gpio = <&gpio_usb_c0_frs_en>; + }; + + tcpc_port0: ps8xxx@1b { + compatible = "parade,ps8xxx"; + reg = <0x1b>; + }; +}; + +&i2c2_0 { + ppc_port1: syv682x@41 { + compatible = "silergy,syv682x"; + status = "okay"; + reg = <0x41>; + frs_en_gpio = <&gpio_usb_c1_frs_en>; + }; + + tcpc_port1: ps8xxx@1b { + compatible = "parade,ps8xxx"; + reg = <0x1b>; + }; +}; diff --git a/zephyr/projects/herobrine/i2c_villager.dts b/zephyr/projects/herobrine/i2c_villager.dts new file mode 100644 index 0000000000..efdf88ac38 --- /dev/null +++ b/zephyr/projects/herobrine/i2c_villager.dts @@ -0,0 +1,34 @@ +/* Copyright 2022 The ChromiumOS Authors + * Use of this source code is governed by a BSD-style license that can be + * found in the LICENSE file. + */ + +#include "i2c_common.dtsi" + +&i2c1_0 { + ppc_port0: syv682x@41 { + compatible = "silergy,syv682x"; + status = "okay"; + reg = <0x41>; + frs_en_gpio = <&gpio_usb_c0_frs_en>; + }; + + tcpc_port0: ps8xxx@b { + compatible = "parade,ps8xxx"; + reg = <0xb>; + }; +}; + +&i2c2_0 { + ppc_port1: syv682x@41 { + compatible = "silergy,syv682x"; + status = "okay"; + reg = <0x41>; + frs_en_gpio = <&gpio_usb_c1_frs_en>; + }; + + tcpc_port1: ps8xxx@b { + compatible = "parade,ps8xxx"; + reg = <0xb>; + }; +}; diff --git a/zephyr/projects/herobrine/include/board_chipset.h b/zephyr/projects/herobrine/include/board_chipset.h new file mode 100644 index 0000000000..8350ef10ff --- /dev/null +++ b/zephyr/projects/herobrine/include/board_chipset.h @@ -0,0 +1,11 @@ +/* Copyright 2022 The ChromiumOS Authors. + * Use of this source code is governed by a BSD-style license that can be + * found in the LICENSE file. + */ + +#ifndef __CROS_EC_HEROBRINE_BOARD_CHIPSET_H +#define __CROS_EC_HEROBRINE_BOARD_CHIPSET_H + +__test_only void reset_pp5000_inited(void); + +#endif /* __CROS_EC_HEROBRINE_BOARD_CHIPSET_H */ diff --git a/zephyr/projects/herobrine/include/gpio_map.h b/zephyr/projects/herobrine/include/gpio_map.h deleted file mode 100644 index c2b81fe5c6..0000000000 --- a/zephyr/projects/herobrine/include/gpio_map.h +++ /dev/null @@ -1,9 +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 - -#endif /* __ZEPHYR_GPIO_MAP_H */ diff --git a/zephyr/projects/herobrine/interrupts.dts b/zephyr/projects/herobrine/interrupts.dts index 23902a7d05..82650bfc51 100644 --- a/zephyr/projects/herobrine/interrupts.dts +++ b/zephyr/projects/herobrine/interrupts.dts @@ -1,4 +1,4 @@ -/* Copyright 2022 The Chromium OS Authors. All rights reserved. +/* Copyright 2022 The ChromiumOS Authors * Use of this source code is governed by a BSD-style license that can be * found in the LICENSE file. */ diff --git a/zephyr/projects/herobrine/keyboard.dts b/zephyr/projects/herobrine/keyboard.dts index 202b61bb4f..3b7e830f2f 100644 --- a/zephyr/projects/herobrine/keyboard.dts +++ b/zephyr/projects/herobrine/keyboard.dts @@ -1,4 +1,4 @@ -/* Copyright 2022 The Chromium OS Authors. All rights reserved. +/* Copyright 2022 The ChromiumOS Authors * Use of this source code is governed by a BSD-style license that can be * found in the LICENSE file. */ @@ -7,7 +7,6 @@ kblight { compatible = "cros-ec,kblight-pwm"; pwms = <&pwm3 0 PWM_KHZ(10) PWM_POLARITY_NORMAL>; - frequency = <10000>; generic-pwm-channel = <0>; }; }; diff --git a/zephyr/projects/herobrine/led_pins_evoker.dts b/zephyr/projects/herobrine/led_pins_evoker.dts new file mode 100644 index 0000000000..ff2dc0e36c --- /dev/null +++ b/zephyr/projects/herobrine/led_pins_evoker.dts @@ -0,0 +1,54 @@ +/* Copyright 2022 The ChromiumOS Authors + * Use of this source code is governed by a BSD-style license that can be + * found in the LICENSE file. + */ + +/ { + gpio-led-pins { + compatible = "cros-ec,gpio-led-pins"; + + color_power_off: color-power-off { + led-color = "LED_OFF"; + led-id = "EC_LED_ID_POWER_LED"; + led-pins = <&gpio_ec_chg_led_w_c1 0>; + }; + + color_power_white: color-power-white { + led-color = "LED_WHITE"; + led-id = "EC_LED_ID_POWER_LED"; + led-pins = <&gpio_ec_chg_led_w_c1 1>; + }; + + color_battery_off: color-battery-off { + led-color = "LED_OFF"; + led-id = "EC_LED_ID_BATTERY_LED"; + led-pins = <&gpio_ec_chg_led_y_c0 0>, + <&gpio_ec_chg_led_w_c0 0>, + <&gpio_ec_chg_led_r_c0 0>; + }; + + color_battery_amber: color-battery-amber { + led-color = "LED_AMBER"; + led-id = "EC_LED_ID_BATTERY_LED"; + led-pins = <&gpio_ec_chg_led_y_c0 1>, + <&gpio_ec_chg_led_w_c0 0>, + <&gpio_ec_chg_led_r_c0 0>; + }; + + color_battery_white: color-battery-white { + led-color = "LED_WHITE"; + led-id = "EC_LED_ID_BATTERY_LED"; + led-pins = <&gpio_ec_chg_led_y_c0 0>, + <&gpio_ec_chg_led_w_c0 1>, + <&gpio_ec_chg_led_r_c0 0>; + }; + + color_battery_red: color-battery-red { + led-color = "LED_RED"; + led-id = "EC_LED_ID_BATTERY_LED"; + led-pins = <&gpio_ec_chg_led_y_c0 0>, + <&gpio_ec_chg_led_w_c0 0>, + <&gpio_ec_chg_led_r_c0 1>; + }; + }; +}; diff --git a/zephyr/projects/herobrine/led_pins_herobrine.dts b/zephyr/projects/herobrine/led_pins_herobrine.dts index cdc5f03904..c509ab1a64 100644 --- a/zephyr/projects/herobrine/led_pins_herobrine.dts +++ b/zephyr/projects/herobrine/led_pins_herobrine.dts @@ -1,4 +1,4 @@ -/* Copyright 2022 The Chromium OS Authors. All rights reserved. +/* Copyright 2022 The ChromiumOS Authors * Use of this source code is governed by a BSD-style license that can be * found in the LICENSE file. */ diff --git a/zephyr/projects/herobrine/led_pins_hoglin.dts b/zephyr/projects/herobrine/led_pins_hoglin.dts index 8603b4e61d..7b125c5cac 100644 --- a/zephyr/projects/herobrine/led_pins_hoglin.dts +++ b/zephyr/projects/herobrine/led_pins_hoglin.dts @@ -1,4 +1,4 @@ -/* Copyright 2022 The Chromium OS Authors. All rights reserved. +/* Copyright 2022 The ChromiumOS Authors * Use of this source code is governed by a BSD-style license that can be * found in the LICENSE file. */ diff --git a/zephyr/projects/herobrine/led_pins_villager.dts b/zephyr/projects/herobrine/led_pins_villager.dts index 67a1d1926c..b0913cdbce 100644 --- a/zephyr/projects/herobrine/led_pins_villager.dts +++ b/zephyr/projects/herobrine/led_pins_villager.dts @@ -1,4 +1,4 @@ -/* Copyright 2022 The Chromium OS Authors. All rights reserved. +/* Copyright 2022 The ChromiumOS Authors * Use of this source code is governed by a BSD-style license that can be * found in the LICENSE file. */ diff --git a/zephyr/projects/herobrine/led_policy_evoker.dts b/zephyr/projects/herobrine/led_policy_evoker.dts new file mode 100644 index 0000000000..fc17755ede --- /dev/null +++ b/zephyr/projects/herobrine/led_policy_evoker.dts @@ -0,0 +1,86 @@ +#include <dt-bindings/battery.h> + +/ { + led-colors { + compatible = "cros-ec,led-policy"; + + battery-state-charge { + charge-state = "PWR_STATE_CHARGE"; + + color-0 { + led-color = <&color_battery_amber>; + }; + }; + + battery-state-near-full { + charge-state = "PWR_STATE_CHARGE_NEAR_FULL"; + + color-0 { + led-color = <&color_battery_white>; + }; + }; + + battery-state-discharge { + charge-state = "PWR_STATE_DISCHARGE"; + + color-0 { + led-color = <&color_battery_off>; + }; + }; + + battery-state-error { + charge-state = "PWR_STATE_ERROR"; + + color-0 { + led-color = <&color_battery_red>; + }; + }; + + /* force idle mode */ + battery-state-forced-idle { + charge-state = "PWR_STATE_FORCED_IDLE"; + + /* Red 1 sec, White 1 sec */ + color-0 { + led-color = <&color_battery_red>; + period-ms = <1000>; + }; + + color-1 { + led-color = <&color_battery_white>; + period-ms = <1000>; + }; + }; + + pwr-power-state-s0 { + chipset-state = "POWER_S0"; + + color-0 { + led-color = <&color_power_white>; + }; + }; + + power-state-s3 { + chipset-state = "POWER_S3"; + + /* white LED - on 1 sec, off 1 sec */ + color-0 { + led-color = <&color_power_white>; + period-ms = <1000>; + }; + + color-1 { + led-color = <&color_power_off>; + period-ms = <1000>; + }; + }; + + power-state-s5 { + chipset-state = "POWER_S5"; + + color-0 { + led-color = <&color_power_off>; + }; + }; + }; +}; diff --git a/zephyr/projects/herobrine/led_policy_herobrine.dts b/zephyr/projects/herobrine/led_policy_herobrine.dts index 7e296e6a3a..13e5306deb 100644 --- a/zephyr/projects/herobrine/led_policy_herobrine.dts +++ b/zephyr/projects/herobrine/led_policy_herobrine.dts @@ -2,7 +2,7 @@ / { led-colors { - compatible = "cros-ec,led-colors"; + compatible = "cros-ec,led-policy"; power-state-charge-left { charge-state = "PWR_STATE_CHARGE"; @@ -133,10 +133,9 @@ }; }; - power-state-idle-forced-left { - charge-state = "PWR_STATE_IDLE"; + power-state-forced-idle-left { + charge-state = "PWR_STATE_FORCED_IDLE"; charge-port = <1>; /* Left port */ - extra-flag = "LED_CHFLAG_FORCE_IDLE"; /* Turn off the right LED */ color-0 { @@ -153,10 +152,9 @@ }; }; - power-state-idle-forced-right { - charge-state = "PWR_STATE_IDLE"; + power-state-forced-idle-right { + charge-state = "PWR_STATE_FORCED_IDLE"; charge-port = <0>; /* Right port */ - extra-flag = "LED_CHFLAG_FORCE_IDLE"; /* Turn off the left LED */ color-0 { @@ -173,10 +171,9 @@ }; }; - power-state-idle-default-left { + power-state-idle-left { charge-state = "PWR_STATE_IDLE"; charge-port = <1>; /* Left port */ - extra-flag = "LED_CHFLAG_DEFAULT"; /* Turn off the right LED */ color-0 { @@ -188,10 +185,9 @@ }; }; - power-state-idle-default-right { + power-state-idle-right { charge-state = "PWR_STATE_IDLE"; charge-port = <0>; /* Right port */ - extra-flag = "LED_CHFLAG_DEFAULT"; /* Turn off the left LED */ color-0 { diff --git a/zephyr/projects/herobrine/led_policy_hoglin.dts b/zephyr/projects/herobrine/led_policy_hoglin.dts index 80ee9f7829..043dfbcaa5 100644 --- a/zephyr/projects/herobrine/led_policy_hoglin.dts +++ b/zephyr/projects/herobrine/led_policy_hoglin.dts @@ -1,11 +1,11 @@ -/* Copyright 2022 The Chromium OS Authors. All rights reserved. +/* Copyright 2022 The ChromiumOS Authors * Use of this source code is governed by a BSD-style license that can be * found in the LICENSE file. */ / { led-colors { - compatible = "cros-ec,led-colors"; + compatible = "cros-ec,led-policy"; power-state-charge { charge-state = "PWR_STATE_CHARGE"; @@ -70,9 +70,8 @@ }; }; - power-state-idle-forced { - charge-state = "PWR_STATE_IDLE"; - extra-flag = "LED_CHFLAG_FORCE_IDLE"; + power-state-forced-idle { + charge-state = "PWR_STATE_FORCED_IDLE"; /* Red 2 sec, Blue 2 sec */ color-0 { @@ -87,7 +86,6 @@ power-state-idle-default { charge-state = "PWR_STATE_IDLE"; - extra-flag = "LED_CHFLAG_DEFAULT"; color-0 { led-color = <&color_red>; diff --git a/zephyr/projects/herobrine/led_policy_villager.dts b/zephyr/projects/herobrine/led_policy_villager.dts index 46b0193e61..f8996a3f4b 100644 --- a/zephyr/projects/herobrine/led_policy_villager.dts +++ b/zephyr/projects/herobrine/led_policy_villager.dts @@ -1,11 +1,11 @@ -/* Copyright 2022 The Chromium OS Authors. All rights reserved. +/* Copyright 2022 The ChromiumOS Authors * Use of this source code is governed by a BSD-style license that can be * found in the LICENSE file. */ / { led-colors { - compatible = "cros-ec,led-colors"; + compatible = "cros-ec,led-policy"; power-state-charge { charge-state = "PWR_STATE_CHARGE"; @@ -70,9 +70,8 @@ }; }; - power-state-idle-forced { - charge-state = "PWR_STATE_IDLE"; - extra-flag = "LED_CHFLAG_FORCE_IDLE"; + power-state-forced-idle { + charge-state = "PWR_STATE_FORCED_IDLE"; /* Blue 2 sec, Amber 2 sec */ color-0 { @@ -85,9 +84,8 @@ }; }; - power-state-idle-default { + power-state-idle { charge-state = "PWR_STATE_IDLE"; - extra-flag = "LED_CHFLAG_DEFAULT"; color-0 { led-color = <&color_blue>; diff --git a/zephyr/projects/herobrine/motionsense.dts b/zephyr/projects/herobrine/motionsense.dts index 1d36fcbf47..1955f43284 100644 --- a/zephyr/projects/herobrine/motionsense.dts +++ b/zephyr/projects/herobrine/motionsense.dts @@ -1,4 +1,4 @@ -/* Copyright 2021 The Chromium OS Authors. All rights reserved. +/* Copyright 2021 The ChromiumOS Authors * Use of this source code is governed by a BSD-style license that can be * found in the LICENSE file. */ @@ -27,11 +27,9 @@ motionsense-mutex { compatible = "cros-ec,motionsense-mutex"; lid_mutex: lid-mutex { - label = "LID_MUTEX"; }; mutex_bmi260: bmi260-mutex { - label = "BMI260_MUTEX"; }; }; @@ -40,8 +38,8 @@ compatible = "cros-ec,motionsense-rotation-ref"; lid_rot_ref: lid-rotation-ref { mat33 = <0 1 0 - (-1) 0 0 - 0 0 1>; + 1 0 0 + 0 0 (-1)>; }; base_rot_ref: base-rotation-ref { @@ -134,7 +132,7 @@ /* * List of motion sensors that creates motion_sensors array. - * The label "lid_accel" and "base_accel" are used to indicate + * The nodelabel "lid_accel" and "base_accel" are used to indicate * motion sensor IDs for lid angle calculation. */ motionsense-sensor { @@ -142,7 +140,6 @@ compatible = "cros-ec,bma255"; status = "okay"; - label = "Lid Accel"; active-mask = "SENSOR_ACTIVE_S0_S3"; location = "MOTIONSENSE_LOC_LID"; mutex = <&lid_mutex>; @@ -155,11 +152,9 @@ 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)>; }; }; @@ -169,7 +164,6 @@ compatible = "cros-ec,bmi260-accel"; status = "okay"; - label = "Base Accel"; active-mask = "SENSOR_ACTIVE_S0_S3"; location = "MOTIONSENSE_LOC_BASE"; mutex = <&mutex_bmi260>; @@ -180,11 +174,9 @@ 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)>; }; }; @@ -194,7 +186,6 @@ compatible = "cros-ec,bmi260-gyro"; status = "okay"; - label = "Base Gyro"; active-mask = "SENSOR_ACTIVE_S0_S3"; location = "MOTIONSENSE_LOC_BASE"; mutex = <&mutex_bmi260>; @@ -207,7 +198,6 @@ compatible = "cros-ec,tcs3400-clear"; status = "okay"; - label = "Clear Light"; active-mask = "SENSOR_ACTIVE_S0_S3"; location = "MOTIONSENSE_LOC_CAMERA"; port = <&i2c_sensor>; @@ -219,7 +209,6 @@ "cros-ec,motionsense-sensor-config"; ec-s0 { /* Run ALS sensor in S0 */ - label = "SENSOR_CONFIG_EC_S0"; odr = <1000>; }; }; @@ -229,7 +218,6 @@ 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 */ diff --git a/zephyr/projects/herobrine/motionsense_evoker.dts b/zephyr/projects/herobrine/motionsense_evoker.dts new file mode 100644 index 0000000000..aa7646e0b3 --- /dev/null +++ b/zephyr/projects/herobrine/motionsense_evoker.dts @@ -0,0 +1,148 @@ +/* Copyright 2022 The ChromiumOS Authors + * Use of this source code is governed by a BSD-style license that can be + * found in the LICENSE file. + */ + +#include <dt-bindings/motionsense/utils.h> + + +/ { + aliases { + /* + * motion sense's <>_INT_EVENT is handled + * by alias. Using the alias, each driver creates + * its own <>_INT_EVENT. + */ + bmi260-int = &base_accel; + }; + + /* + * 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"; + lid_mutex: lid-mutex { + }; + + mutex_bmi260: bmi260-mutex { + }; + }; + + /* Rotation matrix used by drivers. */ + motionsense-rotation-ref { + compatible = "cros-ec,motionsense-rotation-ref"; + lid_rot_ref: lid-rotation-ref { + mat33 = <(-1) 0 0 + 0 (-1) 0 + 0 0 1>; + }; + + base_rot_ref: base-rotation-ref { + mat33 = <0 1 0 + (-1) 0 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 { + bma4xx_data: bma4xx-drv-data { + compatible = "cros-ec,drvdata-bma4xx"; + status = "okay"; + }; + + bmi260_data: bmi260-drv-data { + compatible = "cros-ec,drvdata-bmi260"; + status = "okay"; + }; + }; + + /* + * List of motion sensors that creates motion_sensors array. + * The nodelabel "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,bma4xx"; + status = "okay"; + + active-mask = "SENSOR_ACTIVE_S0_S3"; + location = "MOTIONSENSE_LOC_LID"; + mutex = <&lid_mutex>; + port = <&i2c_sensor>; + rot-standard-ref = <&lid_rot_ref>; + default-range = <2>; + drv-data = <&bma4xx_data>; + i2c-spi-addr-flags = "BMA4_I2C_ADDR_PRIMARY"; + configs { + compatible = + "cros-ec,motionsense-sensor-config"; + ec-s0 { + odr = <(10000 | ROUND_UP_FLAG)>; + }; + ec-s3 { + odr = <(10000 | ROUND_UP_FLAG)>; + }; + }; + }; + + base_accel: base-accel { + compatible = "cros-ec,bmi260-accel"; + status = "okay"; + + active-mask = "SENSOR_ACTIVE_S0_S3"; + location = "MOTIONSENSE_LOC_BASE"; + mutex = <&mutex_bmi260>; + port = <&i2c_sensor>; + rot-standard-ref = <&base_rot_ref>; + drv-data = <&bmi260_data>; + configs { + compatible = + "cros-ec,motionsense-sensor-config"; + ec-s0 { + odr = <(10000 | ROUND_UP_FLAG)>; + }; + ec-s3 { + odr = <(10000 | ROUND_UP_FLAG)>; + }; + }; + }; + + base-gyro { + compatible = "cros-ec,bmi260-gyro"; + status = "okay"; + + active-mask = "SENSOR_ACTIVE_S0_S3"; + location = "MOTIONSENSE_LOC_BASE"; + mutex = <&mutex_bmi260>; + port = <&i2c_sensor>; + rot-standard-ref = <&base_rot_ref>; + drv-data = <&bmi260_data>; + }; + }; + + motionsense-sensor-info { + compatible = "cros-ec,motionsense-sensor-info"; + + /* + * list of GPIO interrupts that have to + * be enabled at initial stage + */ + sensor-irqs = <&int_accel_gyro>; + /* list of sensors in force mode */ + accel-force-mode-sensors = <&lid_accel>; + }; +}; diff --git a/zephyr/projects/herobrine/motionsense_hoglin.dts b/zephyr/projects/herobrine/motionsense_hoglin.dts index 3f67347e10..c3935178ff 100644 --- a/zephyr/projects/herobrine/motionsense_hoglin.dts +++ b/zephyr/projects/herobrine/motionsense_hoglin.dts @@ -1,4 +1,4 @@ -/* Copyright 2022 The Chromium OS Authors. All rights reserved. +/* Copyright 2022 The ChromiumOS Authors * Use of this source code is governed by a BSD-style license that can be * found in the LICENSE file. */ @@ -27,11 +27,9 @@ motionsense-mutex { compatible = "cros-ec,motionsense-mutex"; lid_mutex: lid-mutex { - label = "LID_MUTEX"; }; mutex_bmi260: bmi260-mutex { - label = "BMI260_MUTEX"; }; }; @@ -134,7 +132,7 @@ /* * List of motion sensors that creates motion_sensors array. - * The label "lid_accel" and "base_accel" are used to indicate + * The nodelabel "lid_accel" and "base_accel" are used to indicate * motion sensor IDs for lid angle calculation. */ motionsense-sensor { @@ -142,7 +140,6 @@ compatible = "cros-ec,bma4xx"; status = "okay"; - label = "Lid Accel"; active-mask = "SENSOR_ACTIVE_S0_S3"; location = "MOTIONSENSE_LOC_LID"; mutex = <&lid_mutex>; @@ -155,11 +152,9 @@ 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)>; }; }; @@ -169,7 +164,6 @@ compatible = "cros-ec,bmi260-accel"; status = "okay"; - label = "Base Accel"; active-mask = "SENSOR_ACTIVE_S0_S3"; location = "MOTIONSENSE_LOC_BASE"; mutex = <&mutex_bmi260>; @@ -180,11 +174,9 @@ 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)>; }; }; @@ -194,7 +186,6 @@ compatible = "cros-ec,bmi260-gyro"; status = "okay"; - label = "Base Gyro"; active-mask = "SENSOR_ACTIVE_S0_S3"; location = "MOTIONSENSE_LOC_BASE"; mutex = <&mutex_bmi260>; @@ -207,7 +198,6 @@ compatible = "cros-ec,tcs3400-clear"; status = "okay"; - label = "Clear Light"; active-mask = "SENSOR_ACTIVE_S0_S3"; location = "MOTIONSENSE_LOC_CAMERA"; port = <&i2c_sensor>; @@ -219,7 +209,6 @@ "cros-ec,motionsense-sensor-config"; ec-s0 { /* Run ALS sensor in S0 */ - label = "SENSOR_CONFIG_EC_S0"; odr = <1000>; }; }; @@ -229,7 +218,6 @@ 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 */ diff --git a/zephyr/projects/herobrine/motionsense_villager.dts b/zephyr/projects/herobrine/motionsense_villager.dts index 92cc051a8e..31d00e04a5 100644 --- a/zephyr/projects/herobrine/motionsense_villager.dts +++ b/zephyr/projects/herobrine/motionsense_villager.dts @@ -1,4 +1,4 @@ -/* Copyright 2021 The Chromium OS Authors. All rights reserved. +/* Copyright 2021 The ChromiumOS Authors * Use of this source code is governed by a BSD-style license that can be * found in the LICENSE file. */ @@ -26,11 +26,9 @@ motionsense-mutex { compatible = "cros-ec,motionsense-mutex"; lid_mutex: lid-mutex { - label = "LID_MUTEX"; }; mutex_bmi260: bmi260-mutex { - label = "BMI260_MUTEX"; }; }; @@ -73,7 +71,7 @@ /* * List of motion sensors that creates motion_sensors array. - * The label "lid_accel" and "base_accel" are used to indicate + * The nodelabel "lid_accel" and "base_accel" are used to indicate * motion sensor IDs for lid angle calculation. */ motionsense-sensor { @@ -81,7 +79,6 @@ compatible = "cros-ec,kx022"; status = "okay"; - label = "Lid Accel"; active-mask = "SENSOR_ACTIVE_S0_S3"; location = "MOTIONSENSE_LOC_LID"; mutex = <&lid_mutex>; @@ -94,11 +91,9 @@ 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)>; }; }; @@ -108,7 +103,6 @@ compatible = "cros-ec,bmi260-accel"; status = "okay"; - label = "Base Accel"; active-mask = "SENSOR_ACTIVE_S0_S3"; location = "MOTIONSENSE_LOC_BASE"; mutex = <&mutex_bmi260>; @@ -119,11 +113,9 @@ 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)>; }; }; @@ -133,7 +125,6 @@ compatible = "cros-ec,bmi260-gyro"; status = "okay"; - label = "Base Gyro"; active-mask = "SENSOR_ACTIVE_S0_S3"; location = "MOTIONSENSE_LOC_BASE"; mutex = <&mutex_bmi260>; diff --git a/zephyr/projects/herobrine/prj.conf b/zephyr/projects/herobrine/prj.conf index e16d5c7899..2b13023f2d 100644 --- a/zephyr/projects/herobrine/prj.conf +++ b/zephyr/projects/herobrine/prj.conf @@ -1,4 +1,4 @@ -# Copyright 2021 The Chromium OS Authors. All rights reserved. +# Copyright 2021 The ChromiumOS Authors # Use of this source code is governed by a BSD-style license that can be # found in the LICENSE file. @@ -26,9 +26,6 @@ CONFIG_SHELL_HISTORY=y CONFIG_SHELL_TAB=y CONFIG_SHELL_TAB_AUTOCOMPLETION=y -# Miscellaneous configs -CONFIG_PLATFORM_EC_HIBERNATE_PSL=y - # LED CONFIG_PLATFORM_EC_LED_COMMON=n CONFIG_PLATFORM_EC_LED_DT=y @@ -69,7 +66,6 @@ CONFIG_PLATFORM_EC_CMD_BUTTON=y CONFIG_CROS_KB_RAW_NPCX=y # ADC -CONFIG_PLATFORM_EC_ADC=y CONFIG_ADC=y CONFIG_ADC_SHELL=n @@ -114,7 +110,10 @@ CONFIG_PLATFORM_EC_USB_DRP_ACC_TRYSRC=y CONFIG_PLATFORM_EC_USB_PD_5V_EN_CUSTOM=y CONFIG_PLATFORM_EC_USB_PD_VBUS_DETECT_TCPC=y CONFIG_PLATFORM_EC_USB_PD_DISCHARGE_PPC=y +CONFIG_PLATFORM_EC_USB_PD_DPS=y CONFIG_PLATFORM_EC_USB_PD_REV30=y +CONFIG_PLATFORM_EC_USB_PD_TBT_COMPAT_MODE=n +CONFIG_PLATFORM_EC_USB_PD_USB4=n CONFIG_PLATFORM_EC_USB_PD_TCPC_LOW_POWER=y CONFIG_PLATFORM_EC_USB_PD_TCPM_PS8805=y CONFIG_PLATFORM_EC_USB_PD_TCPC_RUNTIME_CONFIG=n diff --git a/zephyr/projects/herobrine/prj_evoker.conf b/zephyr/projects/herobrine/prj_evoker.conf new file mode 100644 index 0000000000..6a57333bfd --- /dev/null +++ b/zephyr/projects/herobrine/prj_evoker.conf @@ -0,0 +1,12 @@ +# Copyright 2022 The ChromiumOS Authors +# Use of this source code is governed by a BSD-style license that can be +# found in the LICENSE file. + +# Evoker board-specific Kconfig settings. +CONFIG_BOARD_EVOKER=y + +# Disable type-c port sourcing 3A +CONFIG_PLATFORM_EC_CONFIG_USB_PD_3A_PORTS=0 + +CONFIG_PLATFORM_EC_ACCEL_BMA255=n +CONFIG_PLATFORM_EC_ACCEL_BMA4XX=y diff --git a/zephyr/projects/herobrine/prj_herobrine.conf b/zephyr/projects/herobrine/prj_herobrine.conf index 3c7eddbae6..bf39f65692 100644 --- a/zephyr/projects/herobrine/prj_herobrine.conf +++ b/zephyr/projects/herobrine/prj_herobrine.conf @@ -1,4 +1,4 @@ -# Copyright 2022 The Chromium OS Authors. All rights reserved. +# Copyright 2022 The ChromiumOS Authors # Use of this source code is governed by a BSD-style license that can be # found in the LICENSE file. diff --git a/zephyr/projects/herobrine/prj_hoglin.conf b/zephyr/projects/herobrine/prj_hoglin.conf index 370e942f45..c6e20937c0 100644 --- a/zephyr/projects/herobrine/prj_hoglin.conf +++ b/zephyr/projects/herobrine/prj_hoglin.conf @@ -1,4 +1,4 @@ -# Copyright 2022 The Chromium OS Authors. All rights reserved. +# Copyright 2022 The ChromiumOS Authors # Use of this source code is governed by a BSD-style license that can be # found in the LICENSE file. diff --git a/zephyr/projects/herobrine/prj_villager.conf b/zephyr/projects/herobrine/prj_villager.conf index 34c366a36f..35eebe6d99 100644 --- a/zephyr/projects/herobrine/prj_villager.conf +++ b/zephyr/projects/herobrine/prj_villager.conf @@ -1,4 +1,4 @@ -# Copyright 2022 The Chromium OS Authors. All rights reserved. +# Copyright 2022 The ChromiumOS Authors # Use of this source code is governed by a BSD-style license that can be # found in the LICENSE file. diff --git a/zephyr/projects/herobrine/prj_zoglin.conf b/zephyr/projects/herobrine/prj_zoglin.conf new file mode 100644 index 0000000000..7f96cf6c79 --- /dev/null +++ b/zephyr/projects/herobrine/prj_zoglin.conf @@ -0,0 +1,15 @@ +# Copyright 2022 The ChromiumOS Authors +# Use of this source code is governed by a BSD-style license that can be +# found in the LICENSE file. + +# Zoglin reference-board-specific Kconfig settings. +CONFIG_BOARD_ZOGLIN=y +CONFIG_PLATFORM_EC_ACCEL_BMA255=n +CONFIG_PLATFORM_EC_ACCEL_BMA4XX=y + +# Sensors +CONFIG_PLATFORM_EC_ALS=y + +# Sensor Drivers +CONFIG_PLATFORM_EC_ALS_TCS3400=y +CONFIG_PLATFORM_EC_ALS_TCS3400_EMULATED_IRQ_EVENT=y diff --git a/zephyr/projects/herobrine/src/board_chipset.c b/zephyr/projects/herobrine/src/board_chipset.c new file mode 100644 index 0000000000..6a58eee99e --- /dev/null +++ b/zephyr/projects/herobrine/src/board_chipset.c @@ -0,0 +1,83 @@ +/* Copyright 2022 The ChromiumOS Authors. + * Use of this source code is governed by a BSD-style license that can be + * found in the LICENSE file. + */ + +/* Herobrine chipset-specific configuration */ + +#include "charger.h" +#include "common.h" +#include "console.h" +#include "battery.h" +#include "gpio.h" +#include "hooks.h" +#include "timer.h" +#include "usb_pd.h" + +#include "board_chipset.h" + +#define CPRINTS(format, args...) cprints(CC_HOOK, format, ##args) +#define CPRINTF(format, args...) cprintf(CC_HOOK, format, ##args) + +/* + * A window of PD negotiation. It starts from the Type-C state reaching + * Attached.SNK, and ends when the PD contract is created. The VBUS may be + * raised anytime in this window. + * + * The current implementation is the worst case scenario: every message the PD + * negotiation is received at the last moment before timeout. More extra time + * is added to compensate the delay internally, like the decision of the DPM. + * + * TODO(waihong): Cancel this timer when the PD contract is negotiated. + */ +#define PD_READY_TIMEOUT \ + (PD_T_SINK_WAIT_CAP + PD_T_SENDER_RESPONSE + PD_T_SINK_TRANSITION + \ + 20 * MSEC) + +#define PD_READY_POLL_DELAY (10 * MSEC) + +static timestamp_t pd_ready_timeout; + +static bool pp5000_inited; + +__test_only void reset_pp5000_inited(void) +{ + pp5000_inited = false; +} + +/* Called on USB PD connected */ +static void board_usb_pd_connect(void) +{ + int soc = -1; + + /* First boot, battery unattached or low SOC */ + if (!pp5000_inited && + ((battery_state_of_charge_abs(&soc) != EC_SUCCESS || + soc < charger_get_min_bat_pct_for_power_on()))) { + pd_ready_timeout = get_time(); + pd_ready_timeout.val += PD_READY_TIMEOUT; + } +} +DECLARE_HOOK(HOOK_USB_PD_CONNECT, board_usb_pd_connect, HOOK_PRIO_DEFAULT); + +static void wait_pd_ready(void) +{ + CPRINTS("Wait PD negotiated VBUS transition %u", + pd_ready_timeout.le.lo); + while (pd_ready_timeout.val && get_time().val < pd_ready_timeout.val) + usleep(PD_READY_POLL_DELAY); +} + +/* Called on AP S5 -> S3 transition */ +static void board_chipset_pre_init(void) +{ + if (!pp5000_inited) { + if (pd_ready_timeout.val) { + wait_pd_ready(); + } + CPRINTS("Enable 5V rail"); + gpio_pin_set_dt(GPIO_DT_FROM_NODELABEL(gpio_en_pp5000_s5), 1); + pp5000_inited = true; + } +} +DECLARE_HOOK(HOOK_CHIPSET_PRE_INIT, board_chipset_pre_init, HOOK_PRIO_DEFAULT); diff --git a/zephyr/projects/herobrine/src/herobrine/alt_dev_replacement.c b/zephyr/projects/herobrine/src/herobrine/alt_dev_replacement.c index 1b5c1e3d92..00acd509f4 100644 --- a/zephyr/projects/herobrine/src/herobrine/alt_dev_replacement.c +++ b/zephyr/projects/herobrine/src/herobrine/alt_dev_replacement.c @@ -1,4 +1,4 @@ -/* Copyright 2021 The Chromium OS Authors. All rights reserved. +/* Copyright 2021 The ChromiumOS Authors * Use of this source code is governed by a BSD-style license that can be * found in the LICENSE file. */ @@ -12,7 +12,7 @@ LOG_MODULE_REGISTER(alt_dev_replacement); #define BOARD_VERSION_UNKNOWN 0xffffffff /* Check board version to decide which ppc is used. */ -static bool board_has_syv_ppc(void) +static bool board_has_alt_ppc(void) { static uint32_t board_version = BOARD_VERSION_UNKNOWN; @@ -29,7 +29,8 @@ static bool board_has_syv_ppc(void) static void check_alternate_devices(void) { /* Configure the PPC driver */ - if (board_has_syv_ppc()) - PPC_ENABLE_ALTERNATE(ppc_port0_syv); + if (board_has_alt_ppc()) + /* Arg is the USB port number */ + PPC_ENABLE_ALTERNATE(0); } DECLARE_HOOK(HOOK_INIT, check_alternate_devices, HOOK_PRIO_DEFAULT); diff --git a/zephyr/projects/herobrine/src/i2c.c b/zephyr/projects/herobrine/src/i2c.c index 3f9abe4674..88b722c42d 100644 --- a/zephyr/projects/herobrine/src/i2c.c +++ b/zephyr/projects/herobrine/src/i2c.c @@ -1,4 +1,4 @@ -/* Copyright 2021 The Chromium OS Authors. All rights reserved. +/* Copyright 2021 The ChromiumOS Authors * Use of this source code is governed by a BSD-style license that can be * found in the LICENSE file. */ diff --git a/zephyr/projects/herobrine/src/usb_pd_policy.c b/zephyr/projects/herobrine/src/usb_pd_policy.c index a2e353d7d4..adc517d3cb 100644 --- a/zephyr/projects/herobrine/src/usb_pd_policy.c +++ b/zephyr/projects/herobrine/src/usb_pd_policy.c @@ -1,4 +1,4 @@ -/* Copyright 2021 The Chromium OS Authors. All rights reserved. +/* Copyright 2021 The ChromiumOS Authors * Use of this source code is governed by a BSD-style license that can be * found in the LICENSE file. */ @@ -13,8 +13,8 @@ #include "usbc_ppc.h" #include "util.h" -#define CPRINTS(format, args...) cprints(CC_USBCHARGE, format, ## args) -#define CPRINTF(format, args...) cprintf(CC_USBCHARGE, format, ## args) +#define CPRINTS(format, args...) cprints(CC_USBCHARGE, format, ##args) +#define CPRINTF(format, args...) cprintf(CC_USBCHARGE, format, ##args) int pd_check_vconn_swap(int port) { @@ -94,11 +94,11 @@ __override int svdm_dp_config(int port, uint32_t *payload) * (3) plug a monitor to the port-1 dongle. */ - payload[0] = VDO(USB_SID_DISPLAYPORT, 1, - CMD_DP_CONFIG | VDO_OPOS(opos)); - payload[1] = VDO_DP_CFG(pin_mode, /* pin mode */ - 1, /* DPv1.3 signaling */ - 2); /* UFP connected */ + payload[0] = + VDO(USB_SID_DISPLAYPORT, 1, CMD_DP_CONFIG | VDO_OPOS(opos)); + payload[1] = VDO_DP_CFG(pin_mode, /* pin mode */ + 1, /* DPv1.3 signaling */ + 2); /* UFP connected */ return 2; }; @@ -176,8 +176,7 @@ __override int svdm_dp_attention(int port, uint32_t *payload) * because of the board USB-C topology (limited to 2 * lanes DP). */ - usb_mux_set(port, USB_PD_MUX_DOCK, - USB_SWITCH_CONNECT, + usb_mux_set(port, USB_PD_MUX_DOCK, USB_SWITCH_CONNECT, polarity_rm_dts(pd_get_polarity(port))); } else { /* Disconnect the DP port selection mux. */ @@ -189,13 +188,11 @@ __override int svdm_dp_attention(int port, uint32_t *payload) ppc_set_sbu(port, 0); /* Disconnect the DP but keep the USB SS lines in TCPC chip. */ - usb_mux_set(port, USB_PD_MUX_USB_ENABLED, - USB_SWITCH_CONNECT, + usb_mux_set(port, USB_PD_MUX_USB_ENABLED, USB_SWITCH_CONNECT, polarity_rm_dts(pd_get_polarity(port))); } - if (chipset_in_state(CHIPSET_STATE_ANY_SUSPEND) && - (irq || lvl)) + if (chipset_in_state(CHIPSET_STATE_ANY_SUSPEND) && (irq || lvl)) /* * Wake up the AP. IRQ or level high indicates a DP sink is now * present. @@ -222,8 +219,8 @@ __override int svdm_dp_attention(int port, uint32_t *payload) CPRINTS("C%d: Recv IRQ. HPD->1", port); /* Set the minimum time delay (2ms) for the next HPD IRQ */ - svdm_hpd_deadline[port] = get_time().val + - HPD_USTREAM_DEBOUNCE_LVL; + svdm_hpd_deadline[port] = + get_time().val + HPD_USTREAM_DEBOUNCE_LVL; } else if (irq & !lvl) { CPRINTF("ERR:HPD:IRQ&LOW\n"); return 0; @@ -231,8 +228,8 @@ __override int svdm_dp_attention(int port, uint32_t *payload) CPRINTS("C%d: Recv lvl. HPD->%d", port, lvl); gpio_pin_set_dt(hpd, lvl); /* Set the minimum time delay (2ms) for the next HPD IRQ */ - svdm_hpd_deadline[port] = get_time().val + - HPD_USTREAM_DEBOUNCE_LVL; + svdm_hpd_deadline[port] = + get_time().val + HPD_USTREAM_DEBOUNCE_LVL; } return 1; @@ -248,10 +245,10 @@ __override void svdm_exit_dp_mode(int port) /* Signal AP for the HPD low event */ usb_mux_hpd_update(port, USB_PD_MUX_HPD_LVL_DEASSERTED | - USB_PD_MUX_HPD_IRQ_DEASSERTED); + USB_PD_MUX_HPD_IRQ_DEASSERTED); CPRINTS("C%d: DP exit. HPD->0", port); - gpio_pin_set_dt( - GPIO_DT_FROM_NODELABEL(gpio_dp_hot_plug_det_r), 0); + gpio_pin_set_dt(GPIO_DT_FROM_NODELABEL(gpio_dp_hot_plug_det_r), + 0); } } #endif /* CONFIG_USB_PD_ALT_MODE_DFP */ diff --git a/zephyr/projects/herobrine/src/usbc_config.c b/zephyr/projects/herobrine/src/usbc_config.c index 41319a75e9..f040ab12cb 100644 --- a/zephyr/projects/herobrine/src/usbc_config.c +++ b/zephyr/projects/herobrine/src/usbc_config.c @@ -1,4 +1,4 @@ -/* Copyright 2021 The Chromium OS Authors. All rights reserved. +/* Copyright 2021 The ChromiumOS Authors * Use of this source code is governed by a BSD-style license that can be * found in the LICENSE file. */ @@ -28,9 +28,8 @@ #include "usbc_ppc.h" #include "usbc/ppc.h" -#define CPRINTS(format, args...) cprints(CC_USBCHARGE, format, ## args) -#define CPRINTF(format, args...) cprintf(CC_USBCHARGE, format, ## args) - +#define CPRINTS(format, args...) cprints(CC_USBCHARGE, format, ##args) +#define CPRINTF(format, args...) cprintf(CC_USBCHARGE, format, ##args) /* GPIO Interrupt Handlers */ void tcpc_alert_event(enum gpio_signal signal) @@ -54,9 +53,9 @@ void tcpc_alert_event(enum gpio_signal signal) static void usba_oc_deferred(void) { /* Use next number after all USB-C ports to indicate the USB-A port */ - board_overcurrent_event(CONFIG_USB_PD_PORT_MAX_COUNT, - !gpio_pin_get_dt( - GPIO_DT_FROM_NODELABEL(gpio_usb_a0_oc_odl))); + board_overcurrent_event( + CONFIG_USB_PD_PORT_MAX_COUNT, + !gpio_pin_get_dt(GPIO_DT_FROM_NODELABEL(gpio_usb_a0_oc_odl))); } DECLARE_DEFERRED(usba_oc_deferred); @@ -148,7 +147,7 @@ void board_tcpc_init(void) */ for (int port = 0; port < CONFIG_USB_PD_PORT_MAX_COUNT; ++port) usb_mux_hpd_update(port, USB_PD_MUX_HPD_LVL_DEASSERTED | - USB_PD_MUX_HPD_IRQ_DEASSERTED); + USB_PD_MUX_HPD_IRQ_DEASSERTED); } DECLARE_HOOK(HOOK_INIT, board_tcpc_init, HOOK_PRIO_POST_I2C); @@ -194,8 +193,7 @@ void board_overcurrent_event(int port, int is_overcurrented) int board_set_active_charge_port(int port) { - int is_real_port = (port >= 0 && - port < CONFIG_USB_PD_PORT_MAX_COUNT); + int is_real_port = (port >= 0 && port < CONFIG_USB_PD_PORT_MAX_COUNT); int i; if (!is_real_port && port != CHARGE_PORT_NONE) @@ -223,7 +221,6 @@ int board_set_active_charge_port(int port) return EC_ERROR_INVAL; } - CPRINTS("New charge port: p%d", port); /* @@ -247,23 +244,21 @@ int board_set_active_charge_port(int port) return EC_SUCCESS; } -void board_set_charge_limit(int port, int supplier, int charge_ma, - int max_ma, int charge_mv) +void board_set_charge_limit(int port, int supplier, int charge_ma, int max_ma, + int charge_mv) { /* * Ignore lower charge ceiling on PD transition if our battery is * critical, as we may brownout. */ - if (supplier == CHARGE_SUPPLIER_PD && - charge_ma < 1500 && + if (supplier == CHARGE_SUPPLIER_PD && charge_ma < 1500 && charge_get_percent() < CONFIG_CHARGER_MIN_BAT_PCT_FOR_POWER_ON) { CPRINTS("Using max ilim %d", max_ma); charge_ma = max_ma; } - charge_set_input_current_limit(MAX(charge_ma, - CONFIG_CHARGER_INPUT_CURRENT), - charge_mv); + charge_set_input_current_limit( + MAX(charge_ma, CONFIG_CHARGER_INPUT_CURRENT), charge_mv); } uint16_t tcpc_get_alert_status(void) @@ -272,11 +267,11 @@ uint16_t tcpc_get_alert_status(void) if (!gpio_pin_get_dt(GPIO_DT_FROM_NODELABEL(gpio_usb_c0_pd_int_odl))) if (gpio_pin_get_dt( - GPIO_DT_FROM_NODELABEL(gpio_usb_c0_pd_rst_l))) + GPIO_DT_FROM_NODELABEL(gpio_usb_c0_pd_rst_l))) status |= PD_STATUS_TCPC_ALERT_0; if (!gpio_pin_get_dt(GPIO_DT_FROM_NODELABEL(gpio_usb_c1_pd_int_odl))) if (gpio_pin_get_dt( - GPIO_DT_FROM_NODELABEL(gpio_usb_c1_pd_rst_l))) + GPIO_DT_FROM_NODELABEL(gpio_usb_c1_pd_rst_l))) status |= PD_STATUS_TCPC_ALERT_1; return status; diff --git a/zephyr/projects/herobrine/switchcap.dts b/zephyr/projects/herobrine/switchcap.dts index b246274a7a..ed200a0c6f 100644 --- a/zephyr/projects/herobrine/switchcap.dts +++ b/zephyr/projects/herobrine/switchcap.dts @@ -1,4 +1,4 @@ -/* Copyright 2021 The Chromium OS Authors. All rights reserved. +/* Copyright 2021 The ChromiumOS Authors * Use of this source code is governed by a BSD-style license that can be * found in the LICENSE file. */ diff --git a/zephyr/projects/herobrine/switchcap_hoglin.dts b/zephyr/projects/herobrine/switchcap_hoglin.dts index 37e1a27e2c..7c083667a1 100644 --- a/zephyr/projects/herobrine/switchcap_hoglin.dts +++ b/zephyr/projects/herobrine/switchcap_hoglin.dts @@ -1,4 +1,4 @@ -/* Copyright 2022 The Chromium OS Authors. All rights reserved. +/* Copyright 2022 The ChromiumOS Authors * Use of this source code is governed by a BSD-style license that can be * found in the LICENSE file. */ @@ -7,5 +7,6 @@ switchcap { compatible = "switchcap-gpio"; enable-pin = <&gpio_switchcap_on>; + poff-delay-ms = <550>; }; }; diff --git a/zephyr/projects/herobrine/usbc_evoker.dts b/zephyr/projects/herobrine/usbc_evoker.dts new file mode 100644 index 0000000000..20bd48382f --- /dev/null +++ b/zephyr/projects/herobrine/usbc_evoker.dts @@ -0,0 +1,42 @@ +/* Copyright 2022 The ChromiumOS Authors + * Use of this source code is governed by a BSD-style license that can be + * found in the LICENSE file. + */ + +/ { + usbc { + #address-cells = <1>; + #size-cells = <0>; + + port0@0 { + compatible = "named-usbc-port"; + reg = <0>; + bc12 = <&bc12_port0>; + ppc = <&ppc_port0>; + tcpc = <&tcpc_port0>; + chg = <&charger>; + usb-mux-chain-0 { + compatible = "cros-ec,usb-mux-chain"; + usb-muxes = <&usb_mux_0>; + }; + }; + usb_mux_0: usb-mux-0 { + compatible = "parade,usbc-mux-ps8xxx"; + }; + + port1@1 { + compatible = "named-usbc-port"; + reg = <1>; + bc12 = <&bc12_port1>; + ppc = <&ppc_port1>; + tcpc = <&tcpc_port1>; + usb-mux-chain-1 { + compatible = "cros-ec,usb-mux-chain"; + usb-muxes = <&usb_mux_1>; + }; + }; + usb_mux_1: usb-mux-1 { + compatible = "parade,usbc-mux-ps8xxx"; + }; + }; +}; diff --git a/zephyr/projects/herobrine/usbc_herobrine.dts b/zephyr/projects/herobrine/usbc_herobrine.dts index 153dc44f89..675286ecd7 100644 --- a/zephyr/projects/herobrine/usbc_herobrine.dts +++ b/zephyr/projects/herobrine/usbc_herobrine.dts @@ -1,4 +1,4 @@ -/* Copyright 2021 The Chromium OS Authors. All rights reserved. +/* Copyright 2021 The ChromiumOS Authors * Use of this source code is governed by a BSD-style license that can be * found in the LICENSE file. */ @@ -11,31 +11,15 @@ port0@0 { compatible = "named-usbc-port"; reg = <0>; - bc12 { - compatible = "pericom,pi3usb9201"; - status = "okay"; - irq = <&int_usb_c0_bc12>; - port = <&i2c_power>; - i2c-addr-flags = "PI3USB9201_I2C_ADDR_3_FLAGS"; + bc12 = <&bc12_port0>; + ppc = <&ppc_port0>; + ppc_alt = <&ppc_port0_alt>; + tcpc = <&tcpc_port0>; + chg = <&charger>; + usb-mux-chain-0 { + compatible = "cros-ec,usb-mux-chain"; + usb-muxes = <&usb_mux_0>; }; - ppc_port0: ppc { - compatible = "ti,sn5s330"; - status = "okay"; - port = <&i2c_tcpc0>; - i2c-addr-flags = "SN5S330_ADDR0_FLAGS"; - }; - tcpc { - compatible = "parade,ps8xxx"; - status = "okay"; - port = <&i2c_tcpc0>; - i2c-addr-flags = "PS8XXX_I2C_ADDR1_FLAGS"; - }; - chg { - compatible = "intersil,isl923x"; - status = "okay"; - port = <&i2c_charger>; - }; - usb-muxes = <&usb_mux_0>; }; usb_mux_0: usb-mux-0 { compatible = "parade,usbc-mux-ps8xxx"; @@ -44,39 +28,16 @@ port1@1 { compatible = "named-usbc-port"; reg = <1>; - bc12 { - compatible = "pericom,pi3usb9201"; - status = "okay"; - irq = <&int_usb_c1_bc12>; - port = <&i2c_eeprom>; - i2c-addr-flags = "PI3USB9201_I2C_ADDR_3_FLAGS"; - }; - ppc { - compatible = "ti,sn5s330"; - status = "okay"; - port = <&i2c_tcpc1>; - i2c-addr-flags = "SN5S330_ADDR0_FLAGS"; + bc12 = <&bc12_port1>; + ppc = <&ppc_port1>; + tcpc = <&tcpc_port1>; + usb-mux-chain-1 { + compatible = "cros-ec,usb-mux-chain"; + usb-muxes = <&usb_mux_1>; }; - tcpc { - compatible = "parade,ps8xxx"; - status = "okay"; - port = <&i2c_tcpc1>; - i2c-addr-flags = "PS8XXX_I2C_ADDR1_FLAGS"; - }; - usb-muxes = <&usb_mux_1>; }; usb_mux_1: usb-mux-1 { compatible = "parade,usbc-mux-ps8xxx"; }; }; - usbc-alt-chips { - ppc_port0_syv: ppc-port0 { - compatible = "silergy,syv682x"; - status = "okay"; - port = <&i2c_tcpc0>; - i2c-addr-flags = "SYV682X_ADDR1_FLAGS"; - frs_en_gpio = <&gpio_usb_c0_frs_en>; - alternate-for = <&ppc_port0>; - }; - }; }; diff --git a/zephyr/projects/herobrine/usbc_hoglin.dts b/zephyr/projects/herobrine/usbc_hoglin.dts index 68b262f8ef..20bd48382f 100644 --- a/zephyr/projects/herobrine/usbc_hoglin.dts +++ b/zephyr/projects/herobrine/usbc_hoglin.dts @@ -1,4 +1,4 @@ -/* Copyright 2022 The Chromium OS Authors. All rights reserved. +/* Copyright 2022 The ChromiumOS Authors * Use of this source code is governed by a BSD-style license that can be * found in the LICENSE file. */ @@ -11,32 +11,14 @@ port0@0 { compatible = "named-usbc-port"; reg = <0>; - bc12 { - compatible = "pericom,pi3usb9201"; - status = "okay"; - irq = <&int_usb_c0_bc12>; - port = <&i2c_power>; - i2c-addr-flags = "PI3USB9201_I2C_ADDR_3_FLAGS"; + bc12 = <&bc12_port0>; + ppc = <&ppc_port0>; + tcpc = <&tcpc_port0>; + chg = <&charger>; + usb-mux-chain-0 { + compatible = "cros-ec,usb-mux-chain"; + usb-muxes = <&usb_mux_0>; }; - ppc_port0: ppc { - compatible = "silergy,syv682x"; - status = "okay"; - port = <&i2c_tcpc0>; - i2c-addr-flags = "SYV682X_ADDR1_FLAGS"; - frs_en_gpio = <&gpio_usb_c0_frs_en>; - }; - tcpc { - compatible = "parade,ps8xxx"; - status = "okay"; - port = <&i2c_tcpc0>; - i2c-addr-flags = "PS8XXX_I2C_ADDR2_FLAGS"; - }; - chg { - compatible = "intersil,isl923x"; - status = "okay"; - port = <&i2c_charger>; - }; - usb-muxes = <&usb_mux_0>; }; usb_mux_0: usb-mux-0 { compatible = "parade,usbc-mux-ps8xxx"; @@ -45,27 +27,13 @@ port1@1 { compatible = "named-usbc-port"; reg = <1>; - bc12 { - compatible = "pericom,pi3usb9201"; - status = "okay"; - irq = <&int_usb_c1_bc12>; - port = <&i2c_eeprom>; - i2c-addr-flags = "PI3USB9201_I2C_ADDR_2_FLAGS"; - }; - ppc_port1: ppc { - compatible = "silergy,syv682x"; - status = "okay"; - port = <&i2c_tcpc1>; - i2c-addr-flags = "SYV682X_ADDR1_FLAGS"; - frs_en_gpio = <&gpio_usb_c1_frs_en>; - }; - tcpc { - compatible = "parade,ps8xxx"; - status = "okay"; - port = <&i2c_tcpc1>; - i2c-addr-flags = "PS8XXX_I2C_ADDR2_FLAGS"; + bc12 = <&bc12_port1>; + ppc = <&ppc_port1>; + tcpc = <&tcpc_port1>; + usb-mux-chain-1 { + compatible = "cros-ec,usb-mux-chain"; + usb-muxes = <&usb_mux_1>; }; - usb-muxes = <&usb_mux_1>; }; usb_mux_1: usb-mux-1 { compatible = "parade,usbc-mux-ps8xxx"; diff --git a/zephyr/projects/herobrine/usbc_villager.dts b/zephyr/projects/herobrine/usbc_villager.dts index 90dd88412c..20bd48382f 100644 --- a/zephyr/projects/herobrine/usbc_villager.dts +++ b/zephyr/projects/herobrine/usbc_villager.dts @@ -1,4 +1,4 @@ -/* Copyright 2022 The Chromium OS Authors. All rights reserved. +/* Copyright 2022 The ChromiumOS Authors * Use of this source code is governed by a BSD-style license that can be * found in the LICENSE file. */ @@ -11,32 +11,14 @@ port0@0 { compatible = "named-usbc-port"; reg = <0>; - bc12 { - compatible = "pericom,pi3usb9201"; - status = "okay"; - irq = <&int_usb_c0_bc12>; - port = <&i2c_power>; - i2c-addr-flags = "PI3USB9201_I2C_ADDR_3_FLAGS"; + bc12 = <&bc12_port0>; + ppc = <&ppc_port0>; + tcpc = <&tcpc_port0>; + chg = <&charger>; + usb-mux-chain-0 { + compatible = "cros-ec,usb-mux-chain"; + usb-muxes = <&usb_mux_0>; }; - ppc { - compatible = "silergy,syv682x"; - status = "okay"; - port = <&i2c_tcpc0>; - i2c-addr-flags = "SYV682X_ADDR1_FLAGS"; - frs_en_gpio = <&gpio_usb_c0_frs_en>; - }; - tcpc { - compatible = "parade,ps8xxx"; - status = "okay"; - port = <&i2c_tcpc0>; - i2c-addr-flags = "PS8XXX_I2C_ADDR1_FLAGS"; - }; - chg { - compatible = "intersil,isl923x"; - status = "okay"; - port = <&i2c_charger>; - }; - usb-muxes = <&usb_mux_0>; }; usb_mux_0: usb-mux-0 { compatible = "parade,usbc-mux-ps8xxx"; @@ -45,27 +27,13 @@ port1@1 { compatible = "named-usbc-port"; reg = <1>; - bc12 { - compatible = "pericom,pi3usb9201"; - status = "okay"; - irq = <&int_usb_c1_bc12>; - port = <&i2c_eeprom>; - i2c-addr-flags = "PI3USB9201_I2C_ADDR_3_FLAGS"; - }; - ppc { - compatible = "silergy,syv682x"; - status = "okay"; - port = <&i2c_tcpc1>; - i2c-addr-flags = "SYV682X_ADDR1_FLAGS"; - frs_en_gpio = <&gpio_usb_c1_frs_en>; - }; - tcpc { - compatible = "parade,ps8xxx"; - status = "okay"; - port = <&i2c_tcpc1>; - i2c-addr-flags = "PS8XXX_I2C_ADDR1_FLAGS"; + bc12 = <&bc12_port1>; + ppc = <&ppc_port1>; + tcpc = <&tcpc_port1>; + usb-mux-chain-1 { + compatible = "cros-ec,usb-mux-chain"; + usb-muxes = <&usb_mux_1>; }; - usb-muxes = <&usb_mux_1>; }; usb_mux_1: usb-mux-1 { compatible = "parade,usbc-mux-ps8xxx"; |