diff options
author | Chao Gui <chaogui@google.com> | 2023-01-12 16:50:03 -0800 |
---|---|---|
committer | Chromeos LUCI <chromeos-scoped@luci-project-accounts.iam.gserviceaccount.com> | 2023-01-13 17:40:37 +0000 |
commit | 993ed40ead436cfa93f3ef285436ef8b7c426891 (patch) | |
tree | 680799b98ef1c6bae3c57dc0b1e5e3bd450e8369 | |
parent | d7029ebca1d8110c3baa12ecde5f2540f4e4dc55 (diff) | |
download | chrome-ec-993ed40ead436cfa93f3ef285436ef8b7c426891.tar.gz |
skyrim : Remove EC variant for Morthal
LOW_COVERAGE_REASON= cancelled device specific configuration
BUG=none
BRANCH=none
TEST=zmake compare-builds skyrim
Change-Id: I2f806322dea1a7c3629311e6c4f49cb61c22c444
Signed-off-by: Chao Gui <chaogui@google.com>
Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/ec/+/4163824
Reviewed-by: Diana Z <dzigterman@chromium.org>
Code-Coverage: Zoss <zoss-cl-coverage@prod.google.com>
-rw-r--r-- | zephyr/program/skyrim/BUILD.py | 5 | ||||
-rw-r--r-- | zephyr/program/skyrim/CMakeLists.txt | 5 | ||||
-rw-r--r-- | zephyr/program/skyrim/Kconfig | 6 | ||||
-rw-r--r-- | zephyr/program/skyrim/morthal/CMakeLists.txt | 8 | ||||
-rw-r--r-- | zephyr/program/skyrim/morthal/led_pins.dtsi | 59 | ||||
-rw-r--r-- | zephyr/program/skyrim/morthal/led_policy.dtsi | 103 | ||||
-rw-r--r-- | zephyr/program/skyrim/morthal/motionsense.dtsi | 135 | ||||
-rw-r--r-- | zephyr/program/skyrim/morthal/project.conf | 18 | ||||
-rw-r--r-- | zephyr/program/skyrim/morthal/project.overlay | 162 | ||||
-rw-r--r-- | zephyr/program/skyrim/morthal/src/ppc_config.c | 46 | ||||
-rw-r--r-- | zephyr/program/skyrim/morthal/src/usb_mux_config.c | 142 |
11 files changed, 0 insertions, 689 deletions
diff --git a/zephyr/program/skyrim/BUILD.py b/zephyr/program/skyrim/BUILD.py index cb9f67ed04..ed0f929409 100644 --- a/zephyr/program/skyrim/BUILD.py +++ b/zephyr/program/skyrim/BUILD.py @@ -25,11 +25,6 @@ def register_skyrim_project( register_skyrim_project( - project_name="morthal", -) - - -register_skyrim_project( project_name="skyrim", ) diff --git a/zephyr/program/skyrim/CMakeLists.txt b/zephyr/program/skyrim/CMakeLists.txt index 59b9e13657..2468d1f44d 100644 --- a/zephyr/program/skyrim/CMakeLists.txt +++ b/zephyr/program/skyrim/CMakeLists.txt @@ -17,11 +17,6 @@ zephyr_library_sources_ifdef(CONFIG_PLATFORM_EC_LED_COMMON zephyr_library_sources_ifdef(CONFIG_PLATFORM_EC_AMD_STT "src/stt.c") -if(DEFINED CONFIG_BOARD_MORTHAL) - project(morthal) - add_subdirectory(morthal) -endif() - if(DEFINED CONFIG_BOARD_SKYRIM) project(skyrim) add_subdirectory(skyrim) diff --git a/zephyr/program/skyrim/Kconfig b/zephyr/program/skyrim/Kconfig index f5e2835b35..86fac1ae55 100644 --- a/zephyr/program/skyrim/Kconfig +++ b/zephyr/program/skyrim/Kconfig @@ -2,12 +2,6 @@ # Use of this source code is governed by a BSD-style license that can be # found in the LICENSE file. -config BOARD_MORTHAL - bool "Google Morthal Board" - help - Build Google Morthal reference board. This board uses an AMD SoC - and NPCX9 EC - config BOARD_SKYRIM bool "Google Skyrim Board" help diff --git a/zephyr/program/skyrim/morthal/CMakeLists.txt b/zephyr/program/skyrim/morthal/CMakeLists.txt deleted file mode 100644 index b4819f1e73..0000000000 --- a/zephyr/program/skyrim/morthal/CMakeLists.txt +++ /dev/null @@ -1,8 +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. - -zephyr_library_sources( - "src/ppc_config.c" - "src/usb_mux_config.c" -) diff --git a/zephyr/program/skyrim/morthal/led_pins.dtsi b/zephyr/program/skyrim/morthal/led_pins.dtsi deleted file mode 100644 index 78b9a59c40..0000000000 --- a/zephyr/program/skyrim/morthal/led_pins.dtsi +++ /dev/null @@ -1,59 +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/morthal/led_policy.dtsi b/zephyr/program/skyrim/morthal/led_policy.dtsi deleted file mode 100644 index a075c6b0d2..0000000000 --- a/zephyr/program/skyrim/morthal/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/morthal/motionsense.dtsi b/zephyr/program/skyrim/morthal/motionsense.dtsi deleted file mode 100644 index f943bea4c8..0000000000 --- a/zephyr/program/skyrim/morthal/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/morthal/project.conf b/zephyr/program/skyrim/morthal/project.conf deleted file mode 100644 index 31fcb0691a..0000000000 --- a/zephyr/program/skyrim/morthal/project.conf +++ /dev/null @@ -1,18 +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. - -# Morthal reference-board-specific Kconfig settings. -CONFIG_BOARD_MORTHAL=y - -# TODO(b/215404321): Remove later in board development -CONFIG_PLATFORM_EC_EEPROM_CBI_WP=y -CONFIG_PLATFORM_EC_SYSTEM_UNLOCKED=y - -# Morthal 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 - -# Battery -CONFIG_PLATFORM_EC_BATTERY_PRESENT_GPIO=y diff --git a/zephyr/program/skyrim/morthal/project.overlay b/zephyr/program/skyrim/morthal/project.overlay deleted file mode 100644 index 0188699746..0000000000 --- a/zephyr/program/skyrim/morthal/project.overlay +++ /dev/null @@ -1,162 +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 "../i2c.dtsi" -#include "../interrupts.dtsi" -#include "../keyboard.dtsi" -#include "../usbc.dtsi" - -/* Morthal project DTS includes*/ -#include "led_pins.dtsi" -#include "led_policy.dtsi" -#include "motionsense.dtsi" - -/* Morthal overrides follow... */ -/ { - /* battery overrides */ - batteries { - default_battery: aec_5477109 { - compatible = "aec,5477109", "battery-smart"; - }; - smp_l20m3pg1 { - compatible = "smp,l20m3pg1", "battery-smart"; - }; - }; - - named-gpios { - /* Morthal-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 = <0>; - 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 overlay - * files. - */ - morthal-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; - }; - }; - }; - - /* 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"; - }; -}; - -/* i2c overrides */ -&i2c0_0 { - /delete-node/ nx20p348x@71; -}; - -&i2c4_1 { - /delete-node/ isl9538@9; -}; - -/* usbc overrides */ -&usbc_port0 { - /delete-property/ chg_alt; -}; diff --git a/zephyr/program/skyrim/morthal/src/ppc_config.c b/zephyr/program/skyrim/morthal/src/ppc_config.c deleted file mode 100644 index 8108742fdc..0000000000 --- a/zephyr/program/skyrim/morthal/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. - */ - -/* Morthal 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/morthal/src/usb_mux_config.c b/zephyr/program/skyrim/morthal/src/usb_mux_config.c deleted file mode 100644 index f4b6502b35..0000000000 --- a/zephyr/program/skyrim/morthal/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. - */ - -/* Morthal 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); |