summaryrefslogtreecommitdiff
path: root/common/usb_pd_tcpc.c
diff options
context:
space:
mode:
authorAlec Berg <alecaberg@chromium.org>2015-06-23 17:52:04 -0700
committerChromeOS Commit Bot <chromeos-commit-bot@chromium.org>2015-06-30 17:18:25 +0000
commit82ec2510a3acebbf47f2c366e2eabff80d87cc07 (patch)
tree1157130bccd541f2ac20036acf7e82372917afa0 /common/usb_pd_tcpc.c
parent59576398dbc7676fd7a30c2f87700f3c585d6b7e (diff)
downloadchrome-ec-82ec2510a3acebbf47f2c366e2eabff80d87cc07.tar.gz
pd: refactor tcpm and move alert function to tcpm driver
Refactor the tcpm/tcpc split such that the tcpm driver implements the alert functionality since it may be unique for different tcpc chips. BUG=chrome-os-partner:41842 BRANCH=none TEST=make -j buildall. run on samus and glados. Change-Id: I23f2d7f8627d5337b8d001a09bf27622be24fe33 Signed-off-by: Alec Berg <alecaberg@chromium.org> Reviewed-on: https://chromium-review.googlesource.com/281631 Reviewed-by: Vincent Palatin <vpalatin@chromium.org>
Diffstat (limited to 'common/usb_pd_tcpc.c')
-rw-r--r--common/usb_pd_tcpc.c15
1 files changed, 8 insertions, 7 deletions
diff --git a/common/usb_pd_tcpc.c b/common/usb_pd_tcpc.c
index 307f7c7c0e..1d12620969 100644
--- a/common/usb_pd_tcpc.c
+++ b/common/usb_pd_tcpc.c
@@ -13,6 +13,7 @@
#include "host_command.h"
#include "registers.h"
#include "task.h"
+#include "tcpci.h"
#include "timer.h"
#include "util.h"
#include "usb_pd.h"
@@ -742,16 +743,16 @@ int tcpc_run(int port, int evt)
/* outgoing packet ? */
if ((evt & PD_EVENT_TX) && pd[port].rx_enabled) {
switch (pd[port].tx_type) {
- case TRANSMIT_SOP:
+ case TCPC_TX_SOP:
res = send_validate_message(port,
pd[port].tx_head,
pd[port].tx_data);
break;
- case TRANSMIT_BIST_MODE_2:
+ case TCPC_TX_BIST_MODE_2:
bist_mode_2_tx(port);
res = 0;
break;
- case TRANSMIT_HARD_RESET:
+ case TCPC_TX_HARD_RESET:
res = send_hard_reset(port);
break;
default:
@@ -822,7 +823,7 @@ void pd_rx_event(int port)
task_set_event(PD_PORT_TO_TASK_ID(port), PD_EVENT_RX, 0);
}
-int tcpc_alert_status(int port, uint16_t *alert)
+int tcpc_alert_status(int port, int *alert)
{
/* return the value of the TCPC Alert register */
uint16_t ret = pd[port].alert;
@@ -842,7 +843,7 @@ int tcpc_alert_status_clear(int port, uint16_t mask)
return EC_SUCCESS;
}
-int tcpc_alert_mask_update(int port, uint16_t mask)
+int tcpc_alert_mask_set(int port, uint16_t mask)
{
/* Update the alert mask as specificied by the TCPM */
pd[port].alert_mask = mask;
@@ -971,7 +972,7 @@ static void tcpc_i2c_write(int port, int reg, int len, uint8_t *payload)
case TCPC_REG_ALERT_MASK:
alert = payload[1];
alert |= (payload[2] << 8);
- tcpc_alert_mask_update(port, alert);
+ tcpc_alert_mask_set(port, alert);
break;
case TCPC_REG_RX_DETECT:
tcpc_set_rx_enable(port, payload[1] &
@@ -993,7 +994,7 @@ static void tcpc_i2c_write(int port, int reg, int len, uint8_t *payload)
static int tcpc_i2c_read(int port, int reg, uint8_t *payload)
{
int cc1, cc2;
- uint16_t alert;
+ int alert;
switch (reg) {
case TCPC_REG_VENDOR_ID: