summaryrefslogtreecommitdiff
path: root/board/servo_v4p1/chg_control.c
diff options
context:
space:
mode:
authorJack Rosenthal <jrosenth@chromium.org>2021-11-04 12:11:58 -0600
committerCommit Bot <commit-bot@chromium.org>2021-11-05 04:22:34 +0000
commit252457d4b21f46889eebad61d4c0a65331919cec (patch)
tree01856c4d31d710b20e85a74c8d7b5836e35c3b98 /board/servo_v4p1/chg_control.c
parent08f5a1e6fc2c9467230444ac9b582dcf4d9f0068 (diff)
downloadchrome-ec-stabilize-14526.73.B-ish.tar.gz
In the interest of making long-term branch maintenance incur as little technical debt on us as possible, we should not maintain any files on the branch we are not actually using. This has the added effect of making it extremely clear when merging CLs from the main branch when changes have the possibility to affect us. The follow-on CL adds a convenience script to actually pull updates from the main branch and generate a CL for the update. BUG=b:204206272 BRANCH=ish TEST=make BOARD=arcada_ish && make BOARD=drallion_ish Signed-off-by: Jack Rosenthal <jrosenth@chromium.org> Change-Id: I17e4694c38219b5a0823e0a3e55a28d1348f4b18 Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/ec/+/3262038 Reviewed-by: Jett Rink <jettrink@chromium.org> Reviewed-by: Tom Hughes <tomhughes@chromium.org>
Diffstat (limited to 'board/servo_v4p1/chg_control.c')
-rw-r--r--board/servo_v4p1/chg_control.c80
1 files changed, 0 insertions, 80 deletions
diff --git a/board/servo_v4p1/chg_control.c b/board/servo_v4p1/chg_control.c
deleted file mode 100644
index 19be03a755..0000000000
--- a/board/servo_v4p1/chg_control.c
+++ /dev/null
@@ -1,80 +0,0 @@
-/* Copyright 2020 The Chromium OS Authors. All rights reserved.
- * Use of this source code is governed by a BSD-style license that can be
- * found in the LICENSE file.
- */
-
-#include "chg_control.h"
-#include "gpio.h"
-#include "ioexpanders.h"
-#include "registers.h"
-#include "timer.h"
-#include "usb_pd.h"
-
-#define CHG_P5V_POWER 0
-#define CHG_VBUS_POWER 1
-
-void chg_reset(void)
-{
- /* Disconnect DUT Power */
- chg_power_select(CHG_POWER_OFF);
-
- /* Disconnect CHG CC1(Rd) and CC2(Rd) */
- chg_attach_cc_rds(0);
-
- /* Give time for CHG to detach, use tErrorRecovery. */
- msleep(PD_T_ERROR_RECOVERY);
-
- /* Connect CHG CC1(Rd) and CC2(Rd) to detect charger */
- chg_attach_cc_rds(1);
-}
-
-void chg_power_select(enum chg_power_select_t type)
-{
- switch (type) {
- case CHG_POWER_OFF:
- dut_chg_en(0);
- vbus_dischrg_en(1);
- break;
- case CHG_POWER_PP5000:
- vbus_dischrg_en(0);
- host_or_chg_ctl(CHG_P5V_POWER);
- dut_chg_en(1);
- break;
- case CHG_POWER_VBUS:
- vbus_dischrg_en(0);
- host_or_chg_ctl(CHG_VBUS_POWER);
- dut_chg_en(1);
- break;
- }
-}
-
-void chg_attach_cc_rds(bool en)
-{
- if (en) {
- /*
- * Configure USB_CHG_CC1_MCU and USB_CHG_CC2_MCU as
- * ANALOG input
- */
- STM32_GPIO_MODER(GPIO_A) = (STM32_GPIO_MODER(GPIO_A)
- | (3 << (2*2)) | /* PA2 in ANALOG mode */
- (3 << (2*4))); /* PA4 in ANALOG mode */
- } else {
- /*
- * Configure USB_CHG_CC1_MCU and USB_CHG_CC2_MCU as GPIO and
- * drive high to trigger disconnect.
- * NOTE: The CC line has an external fixed Rd pull-down.
- * Driving the CC line High overrides the pull down and this
- * triggers a disconnection.
- */
- /* Set level high */
- gpio_set_level(GPIO_USB_CHG_CC1_MCU, 1);
- gpio_set_level(GPIO_USB_CHG_CC2_MCU, 1);
-
- /* Disable Analog mode and Enable GPO */
- STM32_GPIO_MODER(GPIO_A) = (STM32_GPIO_MODER(GPIO_A)
- & ~(3 << (2*2) | /* PA2 disable ADC */
- 3 << (2*4))) /* PA4 disable ADC */
- | (1 << (2*2) | /* Set as GPO */
- 1 << (2*4)); /* Set as GPO */
- }
-}