summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--board/samus/extpower.c11
-rw-r--r--board/samus_pd/usb_pd_policy.c20
-rw-r--r--common/charge_state_v2.c41
-rw-r--r--common/host_command_pd.c16
-rw-r--r--common/usb_pd_protocol.c20
-rw-r--r--include/ec_commands.h7
6 files changed, 5 insertions, 110 deletions
diff --git a/board/samus/extpower.c b/board/samus/extpower.c
index c478d50ece..4da7e655a7 100644
--- a/board/samus/extpower.c
+++ b/board/samus/extpower.c
@@ -14,19 +14,10 @@
#include "gpio.h"
#include "hooks.h"
#include "host_command.h"
-#include "system.h"
-/*
- * TODO(crosbug.com/p/29841): remove hack for getting extpower
- * is present status from PD MCU.
- */
-extern int pd_extpower_is_present(void);
int extpower_is_present(void)
{
- if (system_get_board_version() <= BOARD_VERSION_PROTO_2_B)
- return pd_extpower_is_present();
- else
- return gpio_get_level(GPIO_AC_PRESENT);
+ return gpio_get_level(GPIO_AC_PRESENT);
}
/**
diff --git a/board/samus_pd/usb_pd_policy.c b/board/samus_pd/usb_pd_policy.c
index 83d6605418..60f6e1c21f 100644
--- a/board/samus_pd/usb_pd_policy.c
+++ b/board/samus_pd/usb_pd_policy.c
@@ -36,8 +36,6 @@ static unsigned max_mv = -1; /* no cap */
/* Flag for battery status */
static int battery_ok = 1;
-static int charger_connected;
-
int pd_choose_voltage(int cnt, uint32_t *src_caps, uint32_t *rdo)
{
int i;
@@ -142,18 +140,6 @@ static void pd_send_ec_int(void)
gpio_set_level(GPIO_EC_INT_L, 1);
}
-/*
- * TODO(crosbug.com/p/29841): remove hack for getting extpower
- * is present status from PD MCU.
- */
-void pd_charger_change(int c)
-{
- if (charger_connected != c) {
- charger_connected = c;
- pd_send_ec_int();
- }
-}
-
int pd_board_checks(void)
{
static uint64_t last_time;
@@ -203,11 +189,7 @@ static int ec_status_host_cmd(struct host_cmd_handler_args *args)
battery_ok = 0;
}
- /*
- * TODO(crosbug.com/p/29841): remove hack for getting extpower
- * is present status from PD MCU.
- */
- r->status = charger_connected ? EC_CMD_PD_STATUS_FLAG_CHARGER_CONN : 0;
+ r->status = 0;
args->response_size = sizeof(*r);
diff --git a/common/charge_state_v2.c b/common/charge_state_v2.c
index 5b9d32ba89..c44d05e096 100644
--- a/common/charge_state_v2.c
+++ b/common/charge_state_v2.c
@@ -400,23 +400,6 @@ static inline int battery_too_low(void)
curr.batt.voltage <= batt_info->voltage_min));
}
-#ifdef BOARD_SAMUS
-/*
- * TODO(crosbug.com/p/29842): remove this workaround once the AC_PRESENT
- * input is avaible.
- */
-static void check_deep_discharge_again(void)
-{
- /* Check again if power is present */
- if (!extpower_is_present()) {
- /* AP is off, so shut down the EC now */
- CPRINTS("charge force EC hibernate due to low battery");
- system_hibernate(0, 0);
- }
-}
-DECLARE_DEFERRED(check_deep_discharge_again);
-#endif
-
/* Shut everything down before the battery completely dies. */
static void prevent_deep_discharge(void)
{
@@ -424,17 +407,9 @@ static void prevent_deep_discharge(void)
return;
if (chipset_in_state(CHIPSET_STATE_ANY_OFF)) {
-#ifdef BOARD_SAMUS
- /*
- * TODO(crosbug.com/p/29842): remove this workaround once
- * the AC_PRESENT input is avaible.
- */
- hook_call_deferred(check_deep_discharge_again, 10*SECOND);
-#else
/* AP is off, so shut down the EC now */
CPRINTS("charge force EC hibernate due to low battery");
system_hibernate(0, 0);
-#endif
} else if (!shutdown_warning_time.val) {
/* Warn AP battery level is so low we'll shut down */
CPRINTS("charge warn shutdown due to low battery");
@@ -510,27 +485,11 @@ void charger_task(void)
problem(PR_POST_INIT, rv);
else
prev_ac = curr.ac;
-#ifdef BOARD_SAMUS
- /*
- * TODO(crosbug.com/p/29841): remove hack for
- * getting extpower is present status from PD.
- */
- CPRINTS("AC connected");
- host_set_single_event(EC_HOST_EVENT_AC_CONNECTED);
-#endif
} else {
/* Some things are only meaningful on AC */
state_machine_force_idle = 0;
battery_seems_to_be_dead = 0;
prev_ac = curr.ac;
-#ifdef BOARD_SAMUS
- /*
- * TODO(crosbug.com/p/29841): remove hack for
- * getting extpower is present status from PD.
- */
- CPRINTS("AC disconnected");
- host_set_single_event(EC_HOST_EVENT_AC_DISCONNECTED);
-#endif
}
}
charger_get_params(&curr.chg);
diff --git a/common/host_command_pd.c b/common/host_command_pd.c
index 27bc8265fa..ed9f97a21e 100644
--- a/common/host_command_pd.c
+++ b/common/host_command_pd.c
@@ -17,8 +17,6 @@
#define TASK_EVENT_EXCHANGE_PD_STATUS TASK_EVENT_CUSTOM(1)
-static int pd_charger_connected;
-
void host_command_pd_send_status(void)
{
task_set_event(TASK_ID_PDCMD, TASK_EVENT_EXCHANGE_PD_STATUS, 0);
@@ -50,22 +48,10 @@ static void pd_exchange_status(void)
task_wait_event(500*MSEC);
}
- if (rv >= 0)
- pd_charger_connected = pd_status.status &
- EC_CMD_PD_STATUS_FLAG_CHARGER_CONN;
- else
+ if (rv < 0)
CPRINTS("Host command to PD MCU failed");
}
-/*
- * TODO(crosbug.com/p/29841): remove hack for getting extpower
- * is present status from PD MCU.
- */
-int pd_extpower_is_present(void)
-{
- return pd_charger_connected;
-}
-
void pd_command_task(void)
{
diff --git a/common/usb_pd_protocol.c b/common/usb_pd_protocol.c
index 1c6c9f611a..1e37446a2c 100644
--- a/common/usb_pd_protocol.c
+++ b/common/usb_pd_protocol.c
@@ -771,9 +771,6 @@ static void execute_hard_reset(void)
CPRINTF("HARD RESET!\n");
}
-#ifdef BOARD_SAMUS_PD
-extern void pd_charger_change(int c);
-#endif
void pd_task(void)
{
int head;
@@ -888,13 +885,6 @@ void pd_task(void)
break;
case PD_STATE_SNK_DISCONNECTED:
/* Source connection monitoring */
-#ifdef BOARD_SAMUS_PD
- /*
- * TODO(crosbug.com/p/29841): remove hack for
- * getting extpower is present status from PD MCU.
- */
- pd_charger_change(0);
-#endif
if (pd_snk_is_vbus_provided()) {
cc1_volt = pd_adc_read(0);
cc2_volt = pd_adc_read(1);
@@ -941,15 +931,7 @@ void pd_task(void)
timeout = 10*MSEC;
break;
case PD_STATE_SNK_READY:
- /* we have power and we are happy */
-#ifdef BOARD_SAMUS_PD
- /*
- * TODO(crosbug.com/p/29841): remove hack for
- * getting extpower is present status from PD MCU.
- */
- pd_charger_change(1);
-#endif
- /* check vital parameters from time to time */
+ /* we have power, check vitals from time to time */
timeout = 100*MSEC;
break;
#endif /* CONFIG_USB_PD_DUAL_ROLE */
diff --git a/include/ec_commands.h b/include/ec_commands.h
index f09b7c2d08..d867c31dc1 100644
--- a/include/ec_commands.h
+++ b/include/ec_commands.h
@@ -2496,13 +2496,8 @@ struct ec_params_pd_status {
} __packed;
/* Status of PD being sent back to EC */
-/*
- * TODO(crosbug.com/p/29841): remove hack for
- * getting extpower is present status from PD MCU.
- */
-#define EC_CMD_PD_STATUS_FLAG_CHARGER_CONN (1<<0)
struct ec_response_pd_status {
- int8_t status;
+ int8_t status; /* currently empty */
} __packed;
/*****************************************************************************/