diff options
Diffstat (limited to 'zephyr/program/skyrim/crystaldrift')
-rw-r--r-- | zephyr/program/skyrim/crystaldrift/CMakeLists.txt | 12 | ||||
-rw-r--r-- | zephyr/program/skyrim/crystaldrift/battery.dtsi | 15 | ||||
-rw-r--r-- | zephyr/program/skyrim/crystaldrift/crystaldrift.dtsi | 209 | ||||
-rw-r--r-- | zephyr/program/skyrim/crystaldrift/led_pins.dtsi | 61 | ||||
-rw-r--r-- | zephyr/program/skyrim/crystaldrift/led_policy.dtsi | 103 | ||||
-rw-r--r-- | zephyr/program/skyrim/crystaldrift/motionsense.dtsi | 135 | ||||
-rw-r--r-- | zephyr/program/skyrim/crystaldrift/project.conf | 26 | ||||
-rw-r--r-- | zephyr/program/skyrim/crystaldrift/project.overlay | 19 | ||||
-rw-r--r-- | zephyr/program/skyrim/crystaldrift/src/alt_charger.c | 31 | ||||
-rw-r--r-- | zephyr/program/skyrim/crystaldrift/src/fan.c | 62 | ||||
-rw-r--r-- | zephyr/program/skyrim/crystaldrift/src/form_factor.c | 38 | ||||
-rw-r--r-- | zephyr/program/skyrim/crystaldrift/src/ppc_config.c | 46 | ||||
-rw-r--r-- | zephyr/program/skyrim/crystaldrift/src/usb_mux_config.c | 142 |
13 files changed, 0 insertions, 899 deletions
diff --git a/zephyr/program/skyrim/crystaldrift/CMakeLists.txt b/zephyr/program/skyrim/crystaldrift/CMakeLists.txt deleted file mode 100644 index 6e50c3d40e..0000000000 --- a/zephyr/program/skyrim/crystaldrift/CMakeLists.txt +++ /dev/null @@ -1,12 +0,0 @@ -# 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. - -cros_ec_library_include_directories_ifdef(CONFIG_BOARD_CRYSTALDRIFT include) -zephyr_library_sources( - "src/usb_mux_config.c" - "src/ppc_config.c" - "src/form_factor.c" - "src/alt_charger.c" -) -zephyr_library_sources_ifdef(CONFIG_PLATFORM_EC_FAN "src/fan.c") diff --git a/zephyr/program/skyrim/crystaldrift/battery.dtsi b/zephyr/program/skyrim/crystaldrift/battery.dtsi deleted file mode 100644 index 6b1799c233..0000000000 --- a/zephyr/program/skyrim/crystaldrift/battery.dtsi +++ /dev/null @@ -1,15 +0,0 @@ -/* 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: aec_5477109 { - compatible = "aec,5477109", "battery-smart"; - }; - smp_l20m3pg1 { - compatible = "smp,l20m3pg1", "battery-smart"; - }; - }; -}; diff --git a/zephyr/program/skyrim/crystaldrift/crystaldrift.dtsi b/zephyr/program/skyrim/crystaldrift/crystaldrift.dtsi deleted file mode 100644 index 812f97a7c7..0000000000 --- a/zephyr/program/skyrim/crystaldrift/crystaldrift.dtsi +++ /dev/null @@ -1,209 +0,0 @@ -/* 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/usbc_mux.h> - -#include "../i2c.dtsi" - -/ { - named-gpios { - /* Crystaldrift-specific GPIO customizations */ - }; - - named-temp-sensors { - compatible = "cros-ec,temp-sensors"; - soc-pct2075 { - temp_host_high = <100>; - temp_host_halt = <105>; - temp_host_release_high = <80>; - temp_host_release_halt = <80>; - temp_fan_off = <35>; - temp_fan_max = <70>; - power-good-pin = <&gpio_pg_pwr_s5>; - sensor = <&soc_pct2075>; - }; - amb-pct2075 { - power-good-pin = <&gpio_pg_pwr_s5>; - sensor = <&amb_pct2075>; - }; - }; - - /* - * Note this is expected to vary per-board, so we keep it in the board - * dts files. - */ - crystaldrift-fw-config { - compatible = "cros-ec,cbi-fw-config"; - - form-factor { - enum-name = "FW_FORM_FACTOR"; - start = <0>; - size = <1>; - - ff-clamshell { - compatible = "cros-ec,cbi-fw-config-value"; - enum-name = "FW_FF_CLAMSHELL"; - value = <0>; - }; - ff-convertible { - compatible = "cros-ec,cbi-fw-config-value"; - enum-name = "FW_FF_CONVERTIBLE"; - value = <1>; - default; - }; - }; - io-db { - enum-name = "FW_IO_DB"; - start = <6>; - size = <2>; - - io-db-ps8811-ps8818 { - compatible = "cros-ec,cbi-fw-config-value"; - enum-name = "FW_IO_DB_PS8811_PS8818"; - value = <0>; - }; - io-db-none-anx7483 { - compatible = "cros-ec,cbi-fw-config-value"; - enum-name = "FW_IO_DB_NONE_ANX7483"; - value = <1>; - default; - }; - }; - - /* - * FW_CONFIG field to enable fan or not. - */ - fan { - enum-name = "FW_FAN"; - start = <10>; - size = <1>; - - no-fan { - compatible = "cros-ec,cbi-fw-config-value"; - enum-name = "FW_FAN_NOT_PRESENT"; - value = <0>; - }; - fan-present { - compatible = "cros-ec,cbi-fw-config-value"; - enum-name = "FW_FAN_PRESENT"; - value = <1>; - /* - * Set as default so that unprovisioned - * configs will run the fan regardless. - */ - default; - }; - }; - - charger-option { - enum-name = "FW_CHARGER"; - start = <11>; - size = <2>; - - charger-option-isl9241 { - compatible = "cros-ec,cbi-fw-config-value"; - enum-name = "FW_CHARGER_ISL9241"; - value = <0>; - default; - }; - charger-option-isl9538 { - compatible = "cros-ec,cbi-fw-config-value"; - enum-name = "FW_CHARGER_ISL9538"; - value = <1>; - }; - }; - }; - - /* Rotation matrices for motion sensors. */ - motionsense-rotation-ref { - compatible = "cros-ec,motionsense-rotation-ref"; - lid_rot_ref: lid-rotation-ref { - mat33 = <0 (-1) 0 - 1 0 0 - 0 0 1>; - }; - - lid_rot_ref1: lid-rotation-ref1 { - mat33 = <0 1 0 - (-1) 0 0 - 0 0 1>; - }; - - base_rot_ref: base-rotation-ref { - mat33 = <0 1 0 - (-1) 0 0 - 0 0 1>; - }; - }; - - ppc_port0: aoz1380 { - compatible = "aoz,aoz1380"; - status = "okay"; - }; -}; - -&i2c0_0 { - anx7483_port0: anx7483@3e { - compatible = "analogix,anx7483"; - reg = <0x3e>; - board-set = "board_anx7483_c0_mux_set"; - flags = <USB_MUX_FLAG_RESETS_IN_G3>; - }; -}; - -&i2c1_0 { - anx7483_port1: anx7483@3e { - compatible = "analogix,anx7483"; - reg = <0x3e>; - board-set = "board_anx7483_c1_mux_set"; - flags = <USB_MUX_FLAG_RESETS_IN_G3>; - }; - ppc_port1: nx20p348x@71 { - compatible = "nxp,nx20p348x"; - status = "okay"; - reg = <0x71>; - }; - ps8818_port1: ps8818@28 { - compatible = "parade,ps8818"; - reg = <0x28>; - flags = <(USB_MUX_FLAG_RESETS_IN_G3)>; - board-set = "board_c1_ps8818_mux_set"; - }; -}; - -&i2c4_1 { - charger: isl9241@9 { - compatible = "intersil,isl9241"; - status = "okay"; - reg = <0x9>; - }; - alt_charger: isl9538@9 { - compatible = "intersil,isl923x"; - status = "okay"; - reg = <0x9>; - }; -}; - -&usbc_port0 { - chg_alt = <&alt_charger>; - ppc = <&ppc_port0>; - usb-mux-chain-0 { - compatible = "cros-ec,usb-mux-chain"; - usb-muxes = <&amd_fp6_port0 &anx7483_port0>; - }; -}; - -&usbc_port1 { - ppc = <&ppc_port1>; - usb-mux-chain-1-anx { - compatible = "cros-ec,usb-mux-chain"; - usb-muxes = <&amd_fp6_port1 &anx7483_port1>; - }; - usb_mux_chain_ps8818_port1: usb-mux-chain-1-ps { - compatible = "cros-ec,usb-mux-chain"; - usb-muxes = <&amd_fp6_port1 &ps8818_port1>; - alternative-chain; - }; -}; diff --git a/zephyr/program/skyrim/crystaldrift/led_pins.dtsi b/zephyr/program/skyrim/crystaldrift/led_pins.dtsi deleted file mode 100644 index f778a24a51..0000000000 --- a/zephyr/program/skyrim/crystaldrift/led_pins.dtsi +++ /dev/null @@ -1,61 +0,0 @@ -/* 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. - */ - -/ { - pwmleds { - compatible = "pwm-leds"; - - pwm_y: pwm_y { - pwms = <&pwm2 0 PWM_HZ(100) PWM_POLARITY_INVERTED>; - }; - - pwm_w: pwm_w { - pwms = <&pwm3 0 PWM_HZ(100) PWM_POLARITY_INVERTED>; - }; - }; - - pwm-led-pins { - compatible = "cros-ec,pwm-led-pins"; - - color_off: color-off { - led-color = "LED_OFF"; - led-id = "EC_LED_ID_BATTERY_LED"; - led-pwms = <&pwm_y &pwm_w>; - led-values = <0 0>; - }; - - color_amber: color-amber { - led-color = "LED_AMBER"; - led-id = "EC_LED_ID_BATTERY_LED"; - br-color = "EC_LED_COLOR_AMBER"; - led-pwms = <&pwm_y &pwm_w>; - led-values = <100 0>; - }; - - color_white: color-white { - led-color = "LED_WHITE"; - led-id = "EC_LED_ID_BATTERY_LED"; - br-color = "EC_LED_COLOR_WHITE"; - led-pwms = <&pwm_y &pwm_w>; - led-values = <0 100>; - }; - }; -}; - -/* Amber "battery charging" LED */ -&pwm2 { - status = "okay"; - clock-bus = "NPCX_CLOCK_BUS_LFCLK"; - pinctrl-0 = <&pwm2_gpc4>; - pinctrl-names = "default"; -}; - -/* White "battery full" LED */ -&pwm3 { - status = "okay"; - clock-bus = "NPCX_CLOCK_BUS_LFCLK"; - pinctrl-0 = <&pwm3_gp80>; - pinctrl-names = "default"; -}; diff --git a/zephyr/program/skyrim/crystaldrift/led_policy.dtsi b/zephyr/program/skyrim/crystaldrift/led_policy.dtsi deleted file mode 100644 index a075c6b0d2..0000000000 --- a/zephyr/program/skyrim/crystaldrift/led_policy.dtsi +++ /dev/null @@ -1,103 +0,0 @@ -#include <dt-bindings/battery.h> - -/ { - led-colors { - compatible = "cros-ec,led-policy"; - - power-state-charge { - charge-state = "PWR_STATE_CHARGE"; - - color-0 { - led-color = <&color_amber>; - }; - }; - - power-state-discharge-s0 { - charge-state = "PWR_STATE_DISCHARGE"; - chipset-state = "POWER_S0"; - /* Battery percent range (> Low, <= Full) */ - batt-lvl = <(BATTERY_LEVEL_LOW + 1) BATTERY_LEVEL_FULL>; - - color-0 { - led-color = <&color_white>; - }; - }; - - power-state-discharge-s0-batt-low { - charge-state = "PWR_STATE_DISCHARGE"; - chipset-state = "POWER_S0"; - /* Battery percent range (>= Empty, <= Low) */ - batt-lvl = <BATTERY_LEVEL_EMPTY BATTERY_LEVEL_LOW>; - - /* White 2 sec, off 1 sec */ - color-0 { - led-color = <&color_white>; - period-ms = <2000>; - }; - color-1 { - led-color = <&color_off>; - period-ms = <1000>; - }; - }; - - power-state-discharge-s3 { - charge-state = "PWR_STATE_DISCHARGE"; - chipset-state = "POWER_S3"; - - /* White 1 sec, off 1 sec */ - color-0 { - led-color = <&color_white>; - period-ms = <1000>; - }; - color-1 { - led-color = <&color_off>; - period-ms = <1000>; - }; - }; - - power-state-discharge-s5 { - charge-state = "PWR_STATE_DISCHARGE"; - chipset-state = "POWER_S5"; - - color-0 { - led-color = <&color_off>; - }; - }; - - power-state-error { - charge-state = "PWR_STATE_ERROR"; - - /* Amber 1 sec, off 1 sec */ - color-0 { - led-color = <&color_amber>; - period-ms = <1000>; - }; - color-1 { - led-color = <&color_off>; - period-ms = <1000>; - }; - }; - - power-state-near-full { - charge-state = "PWR_STATE_CHARGE_NEAR_FULL"; - - color-0 { - led-color = <&color_white>; - }; - }; - - power-state-forced-idle { - charge-state = "PWR_STATE_FORCED_IDLE"; - - /* Amber 2 sec, White 2 sec */ - color-0 { - led-color = <&color_amber>; - period-ms = <2000>; - }; - color-1 { - led-color = <&color_white>; - period-ms = <2000>; - }; - }; - }; -}; diff --git a/zephyr/program/skyrim/crystaldrift/motionsense.dtsi b/zephyr/program/skyrim/crystaldrift/motionsense.dtsi deleted file mode 100644 index f943bea4c8..0000000000 --- a/zephyr/program/skyrim/crystaldrift/motionsense.dtsi +++ /dev/null @@ -1,135 +0,0 @@ -/* 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. - */ - bmi3xx-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_bmi3xx: bmi3xx-mutex { - }; - }; - - /* - * 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"; - }; - - bmi3xx_data: bmi3xx-drv-data { - compatible = "cros-ec,drvdata-bmi3xx"; - 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>; - drv-data = <&bma4xx_data>; - rot-standard-ref = <&lid_rot_ref>; - default-range = <2>; - configs { - compatible = - "cros-ec,motionsense-sensor-config"; - ec-s0 { - odr = <(12500 | ROUND_UP_FLAG)>; - ec-rate = <100>; - }; - ec-s3 { - odr = <(12500 | ROUND_UP_FLAG)>; - }; - }; - }; - - base_accel: base-accel { - compatible = "cros-ec,bmi3xx-accel"; - status = "okay"; - - active-mask = "SENSOR_ACTIVE_S0_S3"; - location = "MOTIONSENSE_LOC_BASE"; - mutex = <&mutex_bmi3xx>; - port = <&i2c_sensor>; - rot-standard-ref = <&base_rot_ref>; - drv-data = <&bmi3xx_data>; - - configs { - compatible = - "cros-ec,motionsense-sensor-config"; - ec-s0 { - odr = <(12500 | ROUND_UP_FLAG)>; - ec-rate = <100>; - }; - ec-s3 { - odr = <(12500 | ROUND_UP_FLAG)>; - }; - }; - }; - - base-gyro { - compatible = "cros-ec,bmi3xx-gyro"; - status = "okay"; - - active-mask = "SENSOR_ACTIVE_S0_S3"; - location = "MOTIONSENSE_LOC_BASE"; - mutex = <&mutex_bmi3xx>; - port = <&i2c_sensor>; - rot-standard-ref = <&base_rot_ref>; - drv-data = <&bmi3xx_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/program/skyrim/crystaldrift/project.conf b/zephyr/program/skyrim/crystaldrift/project.conf deleted file mode 100644 index e9339c1c3c..0000000000 --- a/zephyr/program/skyrim/crystaldrift/project.conf +++ /dev/null @@ -1,26 +0,0 @@ -# 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. - -# Crystaldrift reference-board-specific Kconfig settings. -CONFIG_BOARD_CRYSTALDRIFT=y - -# CBI WP pin present -CONFIG_PLATFORM_EC_EEPROM_CBI_WP=y - -# LED -CONFIG_PLATFORM_EC_LED_DT=y - -# Crystaldrfit is capable of sinking 100W -CONFIG_PLATFORM_EC_PD_MAX_POWER_MW=100000 -CONFIG_PLATFORM_EC_PD_MAX_CURRENT_MA=5000 -CONFIG_PLATFORM_EC_PD_MAX_VOLTAGE_MV=20000 - -CONFIG_PLATFORM_EC_USBC_RETIMER_ANX7483=y - -# Enable alternative charger chip -CONFIG_PLATFORM_EC_CHARGER_RUNTIME_CONFIG=y -CONFIG_PLATFORM_EC_CHARGER_ISL9238C=y - -# Battery -CONFIG_PLATFORM_EC_BATTERY_PRESENT_GPIO=y diff --git a/zephyr/program/skyrim/crystaldrift/project.overlay b/zephyr/program/skyrim/crystaldrift/project.overlay deleted file mode 100644 index 1192bb0d16..0000000000 --- a/zephyr/program/skyrim/crystaldrift/project.overlay +++ /dev/null @@ -1,19 +0,0 @@ -/* 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. - */ - -/* Skyrim program common DTS includes */ -#include "../adc.dtsi" -#include "../fan.dtsi" -#include "../gpio.dtsi" -#include "../interrupts.dtsi" -#include "../keyboard.dtsi" -#include "../usbc.dtsi" - -/* Crystaldrift project DTS includes*/ -#include "crystaldrift.dtsi" -#include "battery.dtsi" -#include "led_pins.dtsi" -#include "led_policy.dtsi" -#include "motionsense.dtsi" diff --git a/zephyr/program/skyrim/crystaldrift/src/alt_charger.c b/zephyr/program/skyrim/crystaldrift/src/alt_charger.c deleted file mode 100644 index a429457136..0000000000 --- a/zephyr/program/skyrim/crystaldrift/src/alt_charger.c +++ /dev/null @@ -1,31 +0,0 @@ -/* 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 "charger_chips.h" -#include "common.h" -#include "cros_board_info.h" -#include "cros_cbi.h" -#include "hooks.h" - -#include <zephyr/devicetree.h> -#include <zephyr/logging/log.h> - -LOG_MODULE_DECLARE(crystaldrift, CONFIG_SKYRIM_LOG_LEVEL); - -static void alt_charger_init(void) -{ - int ret; - uint32_t val; - - ret = cros_cbi_get_fw_config(FW_CHARGER, &val); - if (ret != 0) { - LOG_ERR("Error retrieving CBI FW_CONFIG field %d", FW_CHARGER); - return; - } - - if (val == FW_CHARGER_ISL9538) - CHG_ENABLE_ALTERNATE(0); -} -DECLARE_HOOK(HOOK_INIT, alt_charger_init, HOOK_PRIO_POST_FIRST); diff --git a/zephyr/program/skyrim/crystaldrift/src/fan.c b/zephyr/program/skyrim/crystaldrift/src/fan.c deleted file mode 100644 index 6645e2a495..0000000000 --- a/zephyr/program/skyrim/crystaldrift/src/fan.c +++ /dev/null @@ -1,62 +0,0 @@ -/* 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 "cros_board_info.h" -#include "cros_cbi.h" -#include "fan.h" -#include "gpio/gpio.h" -#include "hooks.h" - -#include <zephyr/devicetree.h> -#include <zephyr/drivers/gpio.h> -#include <zephyr/logging/log.h> - -LOG_MODULE_DECLARE(crystaldrift, CONFIG_SKYRIM_LOG_LEVEL); - -/* - * Skyrim fan support - */ -static void fan_init(void) -{ - int ret; - uint32_t val; - uint32_t board_version; - /* - * Retrieve the fan config. - */ - ret = cros_cbi_get_fw_config(FW_FAN, &val); - if (ret != 0) { - LOG_ERR("Error retrieving CBI FW_CONFIG field %d", FW_FAN); - return; - } - - ret = cbi_get_board_version(&board_version); - if (ret != EC_SUCCESS) { - LOG_ERR("Error retrieving CBI board version"); - return; - } - - if ((board_version >= 3) && (val != FW_FAN_PRESENT)) { - /* Disable the fan */ - fan_set_count(0); - } -} -DECLARE_HOOK(HOOK_INIT, fan_init, HOOK_PRIO_POST_FIRST); - -/* - * Pcore OCP support - * Note: early boards should note enable this interrupt as they are not - * correctly configured for it. - */ -__override bool board_supports_pcore_ocp(void) -{ - uint32_t board_version; - - if (cbi_get_board_version(&board_version) == EC_SUCCESS && - board_version > 3) - return true; - - return false; -} diff --git a/zephyr/program/skyrim/crystaldrift/src/form_factor.c b/zephyr/program/skyrim/crystaldrift/src/form_factor.c deleted file mode 100644 index 688765617b..0000000000 --- a/zephyr/program/skyrim/crystaldrift/src/form_factor.c +++ /dev/null @@ -1,38 +0,0 @@ -/* 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 "accelgyro.h" -#include "common.h" -#include "cros_board_info.h" -#include "hooks.h" -#include "motionsense_sensors.h" - -#include <zephyr/devicetree.h> -#include <zephyr/logging/log.h> - -LOG_MODULE_DECLARE(crystaldrift, CONFIG_SKYRIM_LOG_LEVEL); - -/* - * Mainboard orientation support. - */ - -#define ALT_MAT SENSOR_ROT_STD_REF_NAME(DT_NODELABEL(lid_rot_ref1)) -#define LID_ACCEL SENSOR_ID(DT_NODELABEL(lid_accel)) - -static void form_factor_init(void) -{ - int ret; - uint32_t val; - /* - * If the board version >=4 - * use ver1 rotation matrix. - */ - ret = cbi_get_board_version(&val); - if (ret == EC_SUCCESS && val >= 4) { - LOG_INF("Switching to ver1 lid"); - motion_sensors[LID_ACCEL].rot_standard_ref = &ALT_MAT; - } -} -DECLARE_HOOK(HOOK_INIT, form_factor_init, HOOK_PRIO_POST_I2C); diff --git a/zephyr/program/skyrim/crystaldrift/src/ppc_config.c b/zephyr/program/skyrim/crystaldrift/src/ppc_config.c deleted file mode 100644 index 3913fda4dc..0000000000 --- a/zephyr/program/skyrim/crystaldrift/src/ppc_config.c +++ /dev/null @@ -1,46 +0,0 @@ -/* 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. - */ - -/* Crystaldrift board-specific PPC code */ - -#include "driver/ppc/aoz1380_public.h" -#include "driver/ppc/nx20p348x.h" -#include "usbc_ppc.h" - -#include <zephyr/drivers/gpio.h> - -#define CPRINTSUSB(format, args...) cprints(CC_USBCHARGE, format, ##args) -#define CPRINTFUSB(format, args...) cprintf(CC_USBCHARGE, format, ##args) - -/* - * In the AOZ1380 PPC, there are no programmable features. We use - * the attached NCT3807 to control a GPIO to indicate 1A5 or 3A0 - * current limits. - */ -int board_aoz1380_set_vbus_source_current_limit(int port, enum tcpc_rp_value rp) -{ - int rv = EC_SUCCESS; - - rv = gpio_pin_set_dt(GPIO_DT_FROM_NODELABEL(ioex_usb_c0_ilim_3a_en), - (rp == TYPEC_RP_3A0) ? 1 : 0); - - return rv; -} - -void ppc_interrupt(enum gpio_signal signal) -{ - switch (signal) { - case GPIO_USB_C0_PPC_INT_ODL: - aoz1380_interrupt(0); - break; - - case GPIO_USB_C1_PPC_INT_ODL: - nx20p348x_interrupt(1); - break; - - default: - break; - } -} diff --git a/zephyr/program/skyrim/crystaldrift/src/usb_mux_config.c b/zephyr/program/skyrim/crystaldrift/src/usb_mux_config.c deleted file mode 100644 index 0e08431360..0000000000 --- a/zephyr/program/skyrim/crystaldrift/src/usb_mux_config.c +++ /dev/null @@ -1,142 +0,0 @@ -/* 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. - */ - -/* Crystaldrift board-specific USB-C mux configuration */ - -#include "console.h" -#include "cros_board_info.h" -#include "cros_cbi.h" -#include "driver/retimer/anx7483_public.h" -#include "hooks.h" -#include "ioexpander.h" -#include "usb_mux.h" -#include "usbc/usb_muxes.h" - -#include <zephyr/drivers/gpio.h> - -#define CPRINTSUSB(format, args...) cprints(CC_USBCHARGE, format, ##args) -#define CPRINTFUSB(format, args...) cprintf(CC_USBCHARGE, format, ##args) - -/* - * USB C0 (general) and C1 (just ANX DB) use IOEX pins to - * indicate flipped polarity to a protection switch. - */ -static int ioex_set_flip(int port, mux_state_t mux_state) -{ - if (port == 0) { - if (mux_state & USB_PD_MUX_POLARITY_INVERTED) - gpio_pin_set_dt( - GPIO_DT_FROM_NODELABEL(ioex_usb_c0_sbu_flip), - 1); - else - gpio_pin_set_dt( - GPIO_DT_FROM_NODELABEL(ioex_usb_c0_sbu_flip), - 0); - } else { - if (mux_state & USB_PD_MUX_POLARITY_INVERTED) - gpio_pin_set_dt( - GPIO_DT_FROM_NODELABEL(ioex_usb_c1_sbu_flip), - 1); - else - gpio_pin_set_dt( - GPIO_DT_FROM_NODELABEL(ioex_usb_c1_sbu_flip), - 0); - } - - return EC_SUCCESS; -} - -int board_anx7483_c0_mux_set(const struct usb_mux *me, mux_state_t mux_state) -{ - /* Set the SBU polarity mux */ - RETURN_ERROR(ioex_set_flip(me->usb_port, mux_state)); - - return anx7483_set_default_tuning(me, mux_state); -} - -int board_anx7483_c1_mux_set(const struct usb_mux *me, mux_state_t mux_state) -{ - bool flipped = mux_state & USB_PD_MUX_POLARITY_INVERTED; - - /* Set the SBU polarity mux */ - RETURN_ERROR(ioex_set_flip(me->usb_port, mux_state)); - - /* Remove flipped from the state for easier compraisons */ - mux_state = mux_state & ~USB_PD_MUX_POLARITY_INVERTED; - - RETURN_ERROR(anx7483_set_default_tuning(me, mux_state)); - - if (mux_state == USB_PD_MUX_USB_ENABLED) { - RETURN_ERROR(anx7483_set_eq(me, ANX7483_PIN_URX1, - ANX7483_EQ_SETTING_12_5DB)); - RETURN_ERROR(anx7483_set_eq(me, ANX7483_PIN_URX2, - ANX7483_EQ_SETTING_12_5DB)); - RETURN_ERROR(anx7483_set_eq(me, ANX7483_PIN_DRX1, - ANX7483_EQ_SETTING_12_5DB)); - RETURN_ERROR(anx7483_set_eq(me, ANX7483_PIN_DRX2, - ANX7483_EQ_SETTING_12_5DB)); - } else if (mux_state == USB_PD_MUX_DP_ENABLED) { - RETURN_ERROR(anx7483_set_eq(me, ANX7483_PIN_URX1, - ANX7483_EQ_SETTING_12_5DB)); - RETURN_ERROR(anx7483_set_eq(me, ANX7483_PIN_URX2, - ANX7483_EQ_SETTING_12_5DB)); - RETURN_ERROR(anx7483_set_eq(me, ANX7483_PIN_UTX1, - ANX7483_EQ_SETTING_12_5DB)); - RETURN_ERROR(anx7483_set_eq(me, ANX7483_PIN_UTX2, - ANX7483_EQ_SETTING_12_5DB)); - } else if (mux_state == USB_PD_MUX_DOCK && !flipped) { - RETURN_ERROR(anx7483_set_eq(me, ANX7483_PIN_URX1, - ANX7483_EQ_SETTING_12_5DB)); - RETURN_ERROR(anx7483_set_eq(me, ANX7483_PIN_URX2, - ANX7483_EQ_SETTING_12_5DB)); - RETURN_ERROR(anx7483_set_eq(me, ANX7483_PIN_DRX1, - ANX7483_EQ_SETTING_12_5DB)); - RETURN_ERROR(anx7483_set_eq(me, ANX7483_PIN_UTX2, - ANX7483_EQ_SETTING_12_5DB)); - } else if (mux_state == USB_PD_MUX_DOCK && flipped) { - RETURN_ERROR(anx7483_set_eq(me, ANX7483_PIN_URX1, - ANX7483_EQ_SETTING_12_5DB)); - RETURN_ERROR(anx7483_set_eq(me, ANX7483_PIN_URX2, - ANX7483_EQ_SETTING_12_5DB)); - RETURN_ERROR(anx7483_set_eq(me, ANX7483_PIN_UTX1, - ANX7483_EQ_SETTING_12_5DB)); - RETURN_ERROR(anx7483_set_eq(me, ANX7483_PIN_DRX2, - ANX7483_EQ_SETTING_12_5DB)); - } - - return EC_SUCCESS; -} - -int board_c1_ps8818_mux_set(const struct usb_mux *me, mux_state_t mux_state) -{ - CPRINTSUSB("C1: PS8818 mux using default tuning"); - - /* Once a DP connection is established, we need to set IN_HPD */ - if (mux_state & USB_PD_MUX_DP_ENABLED) - ioex_set_level(IOEX_USB_C1_HPD_IN_DB, 1); - else - ioex_set_level(IOEX_USB_C1_HPD_IN_DB, 0); - - return 0; -} - -static void setup_mux(void) -{ - uint32_t val; - - if (cros_cbi_get_fw_config(FW_IO_DB, &val) != 0) - CPRINTSUSB("Error finding FW_DB_IO in CBI FW_CONFIG"); - /* Val will have our dts default on error, so continue setup */ - - if (val == FW_IO_DB_PS8811_PS8818) { - CPRINTSUSB("C1: Setting PS8818 mux"); - USB_MUX_ENABLE_ALTERNATIVE(usb_mux_chain_ps8818_port1); - } else if (val == FW_IO_DB_NONE_ANX7483) { - CPRINTSUSB("C1: Setting ANX7483 mux"); - } else { - CPRINTSUSB("Unexpected DB_IO board: %d", val); - } -} -DECLARE_HOOK(HOOK_INIT, setup_mux, HOOK_PRIO_INIT_I2C); |