diff options
Diffstat (limited to 'zephyr/projects/trogdor')
26 files changed, 209 insertions, 258 deletions
diff --git a/zephyr/projects/trogdor/lazor/BUILD.py b/zephyr/projects/trogdor/lazor/BUILD.py index 8e7936f12f..ca1a26bdcf 100644 --- a/zephyr/projects/trogdor/lazor/BUILD.py +++ b/zephyr/projects/trogdor/lazor/BUILD.py @@ -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/trogdor/lazor/CMakeLists.txt b/zephyr/projects/trogdor/lazor/CMakeLists.txt index 47285c66eb..b6d5024707 100644 --- a/zephyr/projects/trogdor/lazor/CMakeLists.txt +++ b/zephyr/projects/trogdor/lazor/CMakeLists.txt @@ -1,10 +1,10 @@ -# 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}") project(lazor) cros_ec_library_include_directories(include) diff --git a/zephyr/projects/trogdor/lazor/adc.dts b/zephyr/projects/trogdor/lazor/adc.dts index 6f0208a1bd..b834001587 100644 --- a/zephyr/projects/trogdor/lazor/adc.dts +++ b/zephyr/projects/trogdor/lazor/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/trogdor/lazor/battery.dts b/zephyr/projects/trogdor/lazor/battery.dts index 0fbb1bf359..2b17dd4761 100644 --- a/zephyr/projects/trogdor/lazor/battery.dts +++ b/zephyr/projects/trogdor/lazor/battery.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/trogdor/lazor/default_gpio_pinctrl.dts b/zephyr/projects/trogdor/lazor/default_gpio_pinctrl.dts index 64da26a672..1819bdbc3e 100644 --- a/zephyr/projects/trogdor/lazor/default_gpio_pinctrl.dts +++ b/zephyr/projects/trogdor/lazor/default_gpio_pinctrl.dts @@ -1,43 +1,43 @@ -/* 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 NPCX7 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 >; + 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 >; }; diff --git a/zephyr/projects/trogdor/lazor/display.dts b/zephyr/projects/trogdor/lazor/display.dts index 6f28e7e81a..65d3a2d91b 100644 --- a/zephyr/projects/trogdor/lazor/display.dts +++ b/zephyr/projects/trogdor/lazor/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/trogdor/lazor/gpio.dts b/zephyr/projects/trogdor/lazor/gpio.dts index 3a20dc865f..a047d7e2f2 100644 --- a/zephyr/projects/trogdor/lazor/gpio.dts +++ b/zephyr/projects/trogdor/lazor/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. */ @@ -67,7 +67,7 @@ enum-name = "GPIO_LID_OPEN"; }; gpio_ap_rst_l: ap_rst_l { - gpios = <&gpioc 1 GPIO_INPUT>; + gpios = <&gpioc 1 (GPIO_INPUT | GPIO_VOLTAGE_1P8)>; enum-name = "GPIO_AP_RST_L"; }; gpio_ps_hold: ps_hold { @@ -79,7 +79,7 @@ enum-name = "GPIO_AP_SUSPEND"; }; gpio_deprecated_ap_rst_req: deprecated_ap_rst_req { - gpios = <&gpioc 2 GPIO_INPUT_PULL_DOWN>; + gpios = <&gpioc 2 (GPIO_INPUT_PULL_DOWN | GPIO_VOLTAGE_1P8)>; enum-name = "GPIO_DEPRECATED_AP_RST_REQ"; }; gpio_power_good: power_good { @@ -87,7 +87,7 @@ enum-name = "GPIO_POWER_GOOD"; }; gpio_warm_reset_l: warm_reset_l { - gpios = <&gpiof 4 GPIO_INPUT>; + gpios = <&gpiof 4 (GPIO_INPUT | GPIO_VOLTAGE_1P8)>; enum-name = "GPIO_WARM_RESET_L"; }; ap_ec_spi_cs_l { @@ -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,17 +235,6 @@ enable-pins = <&gpio_en_usb_a_5v>; }; - def-lvol-io-list { - compatible = "nuvoton,npcx-lvolctrl-def"; - lvol-io-pads = < - &lvol_ioc1 /* AP_RST_L */ - &lvol_ioc2 /* DEPRECATED_AP_RST_REQ */ - &lvol_iof4 /* WARM_RESET_L */ - &lvol_iob3 /* EC_I2C_SENSOR_SCL */ - &lvol_iob2 /* EC_I2C_SENSOR_SDA */ - >; - }; - hibernate-wake-pins { compatible = "cros-ec,hibernate-wake-pins"; wakeup-irqs = < diff --git a/zephyr/projects/trogdor/lazor/gpio_led.dts b/zephyr/projects/trogdor/lazor/gpio_led.dts index d85c6dd1df..c8c026506b 100644 --- a/zephyr/projects/trogdor/lazor/gpio_led.dts +++ b/zephyr/projects/trogdor/lazor/gpio_led.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/trogdor/lazor/host_interface_npcx.dts b/zephyr/projects/trogdor/lazor/host_interface_npcx.dts index 9c6a498940..14efa3c6b2 100644 --- a/zephyr/projects/trogdor/lazor/host_interface_npcx.dts +++ b/zephyr/projects/trogdor/lazor/host_interface_npcx.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/trogdor/lazor/i2c.dts b/zephyr/projects/trogdor/lazor/i2c.dts index aedc254105..e19ad224a9 100644 --- a/zephyr/projects/trogdor/lazor/i2c.dts +++ b/zephyr/projects/trogdor/lazor/i2c.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. */ @@ -9,40 +9,28 @@ i2c_power: power { i2c-port = <&i2c0_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>; - enum-name = "I2C_PORT_VIRTUAL_BATTERY"; - }; - i2c_charger: charger { - i2c-port = <&i2c0_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>; - enum-name = "I2C_PORT_TCPC0"; + enum-names = "I2C_PORT_TCPC0"; }; i2c_tcpc1: tcpc1 { i2c-port = <&i2c2_0>; - enum-name = "I2C_PORT_TCPC1"; + enum-names = "I2C_PORT_TCPC1"; }; 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"; }; }; @@ -53,6 +41,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 { @@ -64,6 +65,18 @@ clock-frequency = <I2C_BITRATE_FAST_PLUS>; pinctrl-0 = <&i2c1_0_sda_scl_gp87_90>; pinctrl-names = "default"; + + ppc_port0: sn5s330@40 { + compatible = "ti,sn5s330"; + status = "okay"; + reg = <0x40>; + }; + + tcpc_port0: ps8xxx@b { + compatible = "parade,ps8xxx"; + status = "okay"; + reg = <0xb>; + }; }; &i2c_ctrl1 { @@ -75,6 +88,18 @@ clock-frequency = <I2C_BITRATE_FAST_PLUS>; pinctrl-0 = <&i2c2_0_sda_scl_gp91_92>; pinctrl-names = "default"; + + ppc_port1: sn5s330@40{ + compatible = "ti,sn5s330"; + status = "okay"; + reg = <0x40>; + }; + + tcpc_port1: ps8xxx@b { + compatible = "parade,ps8xxx"; + status = "okay"; + reg = <0xb>; + }; }; &i2c_ctrl2 { @@ -95,6 +120,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/trogdor/lazor/include/gpio_map.h b/zephyr/projects/trogdor/lazor/include/gpio_map.h deleted file mode 100644 index c2b81fe5c6..0000000000 --- a/zephyr/projects/trogdor/lazor/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/trogdor/lazor/include/sku.h b/zephyr/projects/trogdor/lazor/include/sku.h index 492d1623dd..76825bbba1 100644 --- a/zephyr/projects/trogdor/lazor/include/sku.h +++ b/zephyr/projects/trogdor/lazor/include/sku.h @@ -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/trogdor/lazor/interrupts.dts b/zephyr/projects/trogdor/lazor/interrupts.dts index da9b5297ef..5c2ed35e90 100644 --- a/zephyr/projects/trogdor/lazor/interrupts.dts +++ b/zephyr/projects/trogdor/lazor/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/trogdor/lazor/keyboard.dts b/zephyr/projects/trogdor/lazor/keyboard.dts index 83cd6bced4..b8689b883c 100644 --- a/zephyr/projects/trogdor/lazor/keyboard.dts +++ b/zephyr/projects/trogdor/lazor/keyboard.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,7 +27,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/trogdor/lazor/led.dts b/zephyr/projects/trogdor/lazor/led.dts index 3bdf0147d7..4527afd34c 100644 --- a/zephyr/projects/trogdor/lazor/led.dts +++ b/zephyr/projects/trogdor/lazor/led.dts @@ -1,6 +1,6 @@ / { led-colors { - compatible = "cros-ec,led-colors"; + compatible = "cros-ec,led-policy"; power-state-charge { charge-state = "PWR_STATE_CHARGE"; @@ -65,9 +65,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 { @@ -80,9 +79,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/trogdor/lazor/motionsense.dts b/zephyr/projects/trogdor/lazor/motionsense.dts index adae7a736b..75fe31b997 100644 --- a/zephyr/projects/trogdor/lazor/motionsense.dts +++ b/zephyr/projects/trogdor/lazor/motionsense.dts @@ -1,4 +1,4 @@ -/* Copyright 2020 The Chromium OS Authors. All rights reserved. +/* Copyright 2020 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_bmi160: bmi160-mutex { - label = "BMI160_MUTEX"; }; }; @@ -78,7 +76,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 { @@ -86,7 +84,6 @@ compatible = "cros-ec,bma255"; status = "okay"; - label = "Lid Accel"; active-mask = "SENSOR_ACTIVE_S0_S3_S5"; location = "MOTIONSENSE_LOC_LID"; mutex = <&lid_mutex>; @@ -99,11 +96,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)>; }; }; @@ -113,7 +108,6 @@ compatible = "cros-ec,bmi160-accel"; status = "okay"; - label = "Base Accel"; active-mask = "SENSOR_ACTIVE_S0_S3_S5"; location = "MOTIONSENSE_LOC_BASE"; mutex = <&mutex_bmi160>; @@ -124,11 +118,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)>; }; }; @@ -138,7 +130,6 @@ compatible = "cros-ec,bmi160-gyro"; status = "okay"; - label = "Base Gyro"; active-mask = "SENSOR_ACTIVE_S0_S3_S5"; location = "MOTIONSENSE_LOC_BASE"; mutex = <&mutex_bmi160>; @@ -156,7 +147,6 @@ alt_lid_accel { compatible = "cros-ec,kx022"; status = "okay"; - label = "Lid Accel"; active-mask = "SENSOR_ACTIVE_S0_S3_S5"; location = "MOTIONSENSE_LOC_LID"; mutex = <&lid_mutex>; @@ -168,11 +158,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)>; }; }; diff --git a/zephyr/projects/trogdor/lazor/prj.conf b/zephyr/projects/trogdor/lazor/prj.conf index 44affef2ac..358de69d68 100644 --- a/zephyr/projects/trogdor/lazor/prj.conf +++ b/zephyr/projects/trogdor/lazor/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. @@ -64,7 +64,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 @@ -106,6 +105,8 @@ 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_REV30=n +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_MULTI_PS8XXX=y CONFIG_PLATFORM_EC_USB_PD_TCPM_PS8751=y diff --git a/zephyr/projects/trogdor/lazor/pwm_led.dts b/zephyr/projects/trogdor/lazor/pwm_led.dts index ee21c60c85..0582966d6a 100644 --- a/zephyr/projects/trogdor/lazor/pwm_led.dts +++ b/zephyr/projects/trogdor/lazor/pwm_led.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. */ @@ -20,7 +20,6 @@ pwm-led-pins { compatible = "cros-ec,pwm-led-pins"; - pwm-frequency = <324>; color_off: color-off { led-color = "LED_OFF"; diff --git a/zephyr/projects/trogdor/lazor/src/hibernate.c b/zephyr/projects/trogdor/lazor/src/hibernate.c index 5ad97a8c48..388ff1b087 100644 --- a/zephyr/projects/trogdor/lazor/src/hibernate.c +++ b/zephyr/projects/trogdor/lazor/src/hibernate.c @@ -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. */ @@ -17,12 +17,12 @@ void board_hibernate(void) * Sensors are unpowered in hibernate. Apply PD to the * interrupt lines such that they don't float. */ - gpio_pin_configure_dt(GPIO_DT_FROM_NODELABEL( - gpio_accel_gyro_int_l), - GPIO_DISCONNECTED); - gpio_pin_configure_dt(GPIO_DT_FROM_NODELABEL( - gpio_lid_accel_int_l), - GPIO_DISCONNECTED); + gpio_pin_configure_dt( + GPIO_DT_FROM_NODELABEL(gpio_accel_gyro_int_l), + GPIO_DISCONNECTED); + gpio_pin_configure_dt( + GPIO_DT_FROM_NODELABEL(gpio_lid_accel_int_l), + GPIO_DISCONNECTED); } /* diff --git a/zephyr/projects/trogdor/lazor/src/i2c.c b/zephyr/projects/trogdor/lazor/src/i2c.c index 89e576f81a..6d737b410f 100644 --- a/zephyr/projects/trogdor/lazor/src/i2c.c +++ b/zephyr/projects/trogdor/lazor/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/trogdor/lazor/src/power.c b/zephyr/projects/trogdor/lazor/src/power.c index ee4e1b3b8f..96f9bc43c5 100644 --- a/zephyr/projects/trogdor/lazor/src/power.c +++ b/zephyr/projects/trogdor/lazor/src/power.c @@ -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. */ @@ -51,7 +51,7 @@ static int board_power_handler_init(const struct device *unused) /* Setup a suspend/resume callback */ ap_power_ev_init_callback(&cb, board_power_change, AP_POWER_PRE_INIT | - AP_POWER_SHUTDOWN_COMPLETE); + AP_POWER_SHUTDOWN_COMPLETE); ap_power_ev_add_callback(&cb); return 0; } diff --git a/zephyr/projects/trogdor/lazor/src/sku.c b/zephyr/projects/trogdor/lazor/src/sku.c index dde0549805..1d88437031 100644 --- a/zephyr/projects/trogdor/lazor/src/sku.c +++ b/zephyr/projects/trogdor/lazor/src/sku.c @@ -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. */ @@ -13,8 +13,8 @@ #include "system.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) static uint8_t sku_id; diff --git a/zephyr/projects/trogdor/lazor/src/switchcap.c b/zephyr/projects/trogdor/lazor/src/switchcap.c index 6dc7c3fbab..d8205cbcfc 100644 --- a/zephyr/projects/trogdor/lazor/src/switchcap.c +++ b/zephyr/projects/trogdor/lazor/src/switchcap.c @@ -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. */ @@ -16,8 +16,8 @@ #include "system.h" #include "sku.h" -#define CPRINTS(format, args...) cprints(CC_I2C, format, ## args) -#define CPRINTF(format, args...) cprintf(CC_I2C, format, ## args) +#define CPRINTS(format, args...) cprints(CC_I2C, format, ##args) +#define CPRINTF(format, args...) cprintf(CC_I2C, format, ##args) /* LN9310 switchcap */ const struct ln9310_config_t ln9310_config = { @@ -34,18 +34,16 @@ static void switchcap_init(void) * When the chip in power down mode, it outputs high-Z. * Set pull-down to avoid floating. */ - gpio_pin_configure_dt( - GPIO_DT_FROM_NODELABEL(gpio_da9313_gpio0), - GPIO_INPUT | GPIO_PULL_DOWN); + gpio_pin_configure_dt(GPIO_DT_FROM_NODELABEL(gpio_da9313_gpio0), + GPIO_INPUT | GPIO_PULL_DOWN); /* * Configure DA9313 enable, push-pull output. Don't set the * level here; otherwise, it will override its value and * shutdown the switchcap when sysjump to RW. */ - gpio_pin_configure_dt( - GPIO_DT_FROM_NODELABEL(gpio_switchcap_on), - GPIO_OUTPUT); + gpio_pin_configure_dt(GPIO_DT_FROM_NODELABEL(gpio_switchcap_on), + GPIO_OUTPUT); } else if (board_has_ln9310()) { CPRINTS("Use switchcap: LN9310"); @@ -71,9 +69,8 @@ static void switchcap_init(void) * (6) GPIO init according to gpio.inc -> push-pull LOW * (7) This function configures it -> open-drain LOW */ - gpio_pin_configure_dt( - GPIO_DT_FROM_NODELABEL(gpio_switchcap_on), - GPIO_OUTPUT | GPIO_OPEN_DRAIN); + gpio_pin_configure_dt(GPIO_DT_FROM_NODELABEL(gpio_switchcap_on), + GPIO_OUTPUT | GPIO_OPEN_DRAIN); /* Only configure the switchcap if not sysjump */ if (!system_jumped_late()) { @@ -83,8 +80,7 @@ static void switchcap_init(void) * configured from standby mode to switching mode. */ gpio_pin_set_dt( - GPIO_DT_FROM_NODELABEL(gpio_switchcap_on), - 0); + GPIO_DT_FROM_NODELABEL(gpio_switchcap_on), 0); ln9310_init(); } } else if (board_has_buck_ic()) { @@ -98,18 +94,14 @@ DECLARE_HOOK(HOOK_INIT, switchcap_init, HOOK_PRIO_DEFAULT); void board_set_switchcap_power(int enable) { if (board_has_da9313()) { - gpio_pin_set_dt( - GPIO_DT_FROM_NODELABEL(gpio_switchcap_on), - enable); + gpio_pin_set_dt(GPIO_DT_FROM_NODELABEL(gpio_switchcap_on), + enable); } else if (board_has_ln9310()) { - gpio_pin_set_dt( - GPIO_DT_FROM_NODELABEL(gpio_switchcap_on), - enable); + gpio_pin_set_dt(GPIO_DT_FROM_NODELABEL(gpio_switchcap_on), + enable); ln9310_software_enable(enable); } else if (board_has_buck_ic()) { - gpio_pin_set_dt( - GPIO_DT_FROM_NODELABEL(gpio_vbob_en), - enable); + gpio_pin_set_dt(GPIO_DT_FROM_NODELABEL(gpio_vbob_en), enable); } } @@ -117,18 +109,17 @@ int board_is_switchcap_enabled(void) { if (board_has_da9313() || board_has_ln9310()) return gpio_pin_get_dt( - GPIO_DT_FROM_NODELABEL(gpio_switchcap_on)); + GPIO_DT_FROM_NODELABEL(gpio_switchcap_on)); /* Board has buck ic*/ - return gpio_pin_get_dt( - GPIO_DT_FROM_NODELABEL(gpio_vbob_en)); + return gpio_pin_get_dt(GPIO_DT_FROM_NODELABEL(gpio_vbob_en)); } int board_is_switchcap_power_good(void) { if (board_has_da9313()) return gpio_pin_get_dt( - GPIO_DT_FROM_NODELABEL(gpio_da9313_gpio0)); + GPIO_DT_FROM_NODELABEL(gpio_da9313_gpio0)); else if (board_has_ln9310()) return ln9310_power_good(); diff --git a/zephyr/projects/trogdor/lazor/src/usb_pd_policy.c b/zephyr/projects/trogdor/lazor/src/usb_pd_policy.c index b94a65005a..8d046826f9 100644 --- a/zephyr/projects/trogdor/lazor/src/usb_pd_policy.c +++ b/zephyr/projects/trogdor/lazor/src/usb_pd_policy.c @@ -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. */ @@ -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) { @@ -24,10 +24,10 @@ int pd_check_vconn_swap(int port) static uint8_t vbus_en[CONFIG_USB_PD_PORT_MAX_COUNT]; #if CONFIG_USB_PD_PORT_MAX_COUNT == 1 -static uint8_t vbus_rp[CONFIG_USB_PD_PORT_MAX_COUNT] = {TYPEC_RP_1A5}; +static uint8_t vbus_rp[CONFIG_USB_PD_PORT_MAX_COUNT] = { TYPEC_RP_1A5 }; #else -static uint8_t vbus_rp[CONFIG_USB_PD_PORT_MAX_COUNT] = {TYPEC_RP_1A5, - TYPEC_RP_1A5}; +static uint8_t vbus_rp[CONFIG_USB_PD_PORT_MAX_COUNT] = { TYPEC_RP_1A5, + TYPEC_RP_1A5 }; #endif static void board_vbus_update_source_current(int port) @@ -108,11 +108,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; }; @@ -175,8 +175,8 @@ __override int svdm_dp_attention(int port, uint32_t *payload) * TODO(waihong): Better to move switching DP mux to * the usb_mux abstraction. */ - gpio_pin_set_dt( - GPIO_DT_FROM_NODELABEL(gpio_dp_mux_sel), port == 1); + gpio_pin_set_dt(GPIO_DT_FROM_NODELABEL(gpio_dp_mux_sel), + port == 1); gpio_pin_set_dt(GPIO_DT_FROM_NODELABEL(gpio_dp_mux_oe_l), 0); /* Connect the SBU lines in PPC chip. */ @@ -190,8 +190,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. */ @@ -203,13 +202,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. @@ -234,8 +231,8 @@ __override int svdm_dp_attention(int port, uint32_t *payload) gpio_pin_set_dt(hpd, 1); /* 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; @@ -256,9 +253,9 @@ __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); - gpio_pin_set_dt( - GPIO_DT_FROM_NODELABEL(gpio_dp_hot_plug_det), 0); + USB_PD_MUX_HPD_IRQ_DEASSERTED); + gpio_pin_set_dt(GPIO_DT_FROM_NODELABEL(gpio_dp_hot_plug_det), + 0); } } #endif /* CONFIG_USB_PD_ALT_MODE_DFP */ diff --git a/zephyr/projects/trogdor/lazor/src/usbc_config.c b/zephyr/projects/trogdor/lazor/src/usbc_config.c index 59dbeb6fc6..f6bfdfb186 100644 --- a/zephyr/projects/trogdor/lazor/src/usbc_config.c +++ b/zephyr/projects/trogdor/lazor/src/usbc_config.c @@ -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,8 +27,8 @@ #include "usbc_ocp.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) int charger_profile_override(struct charge_state_data *curr) { @@ -71,9 +71,9 @@ enum ec_status charger_profile_override_set_param(uint32_t param, 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); @@ -137,16 +137,22 @@ void tcpc_alert_event(enum gpio_signal signal) * to AP. But the TCPC chip is also needed to know the HPD status; otherwise, * the mux misbehaves. */ -const struct usb_mux usb_muxes[CONFIG_USB_PD_PORT_MAX_COUNT] = { +const struct usb_mux_chain usb_muxes[CONFIG_USB_PD_PORT_MAX_COUNT] = { { - .usb_port = 0, - .driver = &tcpci_tcpm_usb_mux_driver, - .hpd_update = &ps8xxx_tcpc_update_hpd_status, + .mux = + &(const struct usb_mux){ + .usb_port = 0, + .driver = &tcpci_tcpm_usb_mux_driver, + .hpd_update = &ps8xxx_tcpc_update_hpd_status, + }, }, { - .usb_port = 1, - .driver = &tcpci_tcpm_usb_mux_driver, - .hpd_update = &ps8xxx_tcpc_update_hpd_status, + .mux = + &(const struct usb_mux){ + .usb_port = 1, + .driver = &tcpci_tcpm_usb_mux_driver, + .hpd_update = &ps8xxx_tcpc_update_hpd_status, + }, } }; @@ -199,7 +205,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); @@ -244,8 +250,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) @@ -273,7 +278,6 @@ int board_set_active_charge_port(int port) return EC_ERROR_INVAL; } - CPRINTS("New charge port: p%d", port); /* @@ -297,23 +301,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) @@ -322,11 +324,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_c0_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/trogdor/lazor/usbc.dts b/zephyr/projects/trogdor/lazor/usbc.dts index 051efb09e3..7864c2716b 100644 --- a/zephyr/projects/trogdor/lazor/usbc.dts +++ b/zephyr/projects/trogdor/lazor/usbc.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. */ @@ -15,60 +15,22 @@ 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>; + tcpc = <&tcpc_port0>; - tcpc { - compatible = "parade,ps8xxx"; - status = "okay"; - port = <&i2c_tcpc0>; - i2c-addr-flags = "PS8XXX_I2C_ADDR1_FLAGS"; - }; + ppc = <&ppc_port0>; - ppc { - compatible = "ti,sn5s330"; - status = "okay"; - port = <&i2c_tcpc0>; - i2c-addr-flags = "SN5S330_ADDR0_FLAGS"; - }; - - chg { - compatible = "intersil,isl923x"; - status = "okay"; - port = <&i2c_charger>; - }; + chg = <&charger>; }; 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"; - }; - - tcpc { - compatible = "parade,ps8xxx"; - status = "okay"; - port = <&i2c_tcpc1>; - i2c-addr-flags = "PS8XXX_I2C_ADDR1_FLAGS"; - }; + bc12 = <&bc12_port1>; + tcpc = <&tcpc_port1>; - ppc { - compatible = "ti,sn5s330"; - status = "okay"; - port = <&i2c_tcpc1>; - i2c-addr-flags = "SN5S330_ADDR0_FLAGS"; - }; + ppc = <&ppc_port1>; }; }; }; |