161 lines
5.7 KiB
Diff
161 lines
5.7 KiB
Diff
From: Ondrej Jirman <megous@megous.com>
|
|
Date: Tue, 23 Nov 2021 17:58:05 +0100
|
|
Subject: [PATCH 31/36] usb: typec: fusb302: Make tcpm/fusb302 logs less
|
|
polluted by PD comm stuff
|
|
|
|
This adds clarity to debugging.
|
|
|
|
Signed-off-by: Ondrej Jirman <megous@megous.com>
|
|
---
|
|
drivers/usb/typec/tcpm/fusb302.c | 18 ++++++++++--------
|
|
drivers/usb/typec/tcpm/tcpm.c | 18 ++++++++++--------
|
|
2 files changed, 20 insertions(+), 16 deletions(-)
|
|
|
|
diff --git a/drivers/usb/typec/tcpm/fusb302.c b/drivers/usb/typec/tcpm/fusb302.c
|
|
index 1d5affa..ae3b930 100644
|
|
--- a/drivers/usb/typec/tcpm/fusb302.c
|
|
+++ b/drivers/usb/typec/tcpm/fusb302.c
|
|
@@ -787,7 +787,7 @@ static int tcpm_get_cc(struct tcpc_dev *dev, enum typec_cc_status *cc1,
|
|
mutex_lock(&chip->lock);
|
|
*cc1 = chip->cc1;
|
|
*cc2 = chip->cc2;
|
|
- fusb302_log(chip, "cc1=%s, cc2=%s", typec_cc_status_name[*cc1],
|
|
+ fusb302_log(chip, "tcpm_get_cc => cc1=%s, cc2=%s (cached)", typec_cc_status_name[*cc1],
|
|
typec_cc_status_name[*cc2]);
|
|
mutex_unlock(&chip->lock);
|
|
|
|
@@ -1073,8 +1073,8 @@ static int fusb302_pd_send_message(struct fusb302_chip *chip,
|
|
ret = fusb302_i2c_block_write(chip, FUSB_REG_FIFOS, pos, buf);
|
|
if (ret < 0)
|
|
return ret;
|
|
- fusb302_log(chip, "sending PD message header: %x", msg->header);
|
|
- fusb302_log(chip, "sending PD message len: %d", len);
|
|
+ //fusb302_log(chip, "sending PD message header: %x", msg->header);
|
|
+ //fusb302_log(chip, "sending PD message len: %d", len);
|
|
|
|
return ret;
|
|
}
|
|
@@ -1365,8 +1365,10 @@ static int fusb302_get_src_cc_status(struct fusb302_chip *chip,
|
|
if (ret < 0)
|
|
return ret;
|
|
|
|
+ //XXX resolve activity conflicts while measuring
|
|
+
|
|
fusb302_i2c_read(chip, FUSB_REG_SWITCHES0, &status0);
|
|
- fusb302_log(chip, "get_src_cc_status switches: 0x%0x", status0);
|
|
+ //fusb302_log(chip, "get_src_cc_status switches: 0x%0x", status0);
|
|
|
|
/* Step 2: Set compararator volt to differentiate between Open and Rd */
|
|
ret = fusb302_i2c_write(chip, FUSB_REG_MEASURE, rd_mda);
|
|
@@ -1378,7 +1380,7 @@ static int fusb302_get_src_cc_status(struct fusb302_chip *chip,
|
|
if (ret < 0)
|
|
return ret;
|
|
|
|
- fusb302_log(chip, "get_src_cc_status rd_mda status0: 0x%0x", status0);
|
|
+ //fusb302_log(chip, "get_src_cc_status rd_mda status0: 0x%0x", status0);
|
|
if (status0 & FUSB_REG_STATUS0_COMP) {
|
|
*cc = TYPEC_CC_OPEN;
|
|
return 0;
|
|
@@ -1394,7 +1396,7 @@ static int fusb302_get_src_cc_status(struct fusb302_chip *chip,
|
|
if (ret < 0)
|
|
return ret;
|
|
|
|
- fusb302_log(chip, "get_src_cc_status ra_mda status0: 0x%0x", status0);
|
|
+ //fusb302_log(chip, "get_src_cc_status ra_mda status0: 0x%0x", status0);
|
|
if (status0 & FUSB_REG_STATUS0_COMP)
|
|
*cc = TYPEC_CC_RD;
|
|
else
|
|
@@ -1559,8 +1561,8 @@ static int fusb302_pd_read_message(struct fusb302_chip *chip,
|
|
ret = fusb302_i2c_block_read(chip, FUSB_REG_FIFOS, 4, crc);
|
|
if (ret < 0)
|
|
return ret;
|
|
- fusb302_log(chip, "PD message header: %x", msg->header);
|
|
- fusb302_log(chip, "PD message len: %d", len);
|
|
+ //fusb302_log(chip, "PD message header: %x", msg->header);
|
|
+ //fusb302_log(chip, "PD message len: %d", len);
|
|
|
|
/*
|
|
* Check if we've read off a GoodCRC message. If so then indicate to
|
|
diff --git a/drivers/usb/typec/tcpm/tcpm.c b/drivers/usb/typec/tcpm/tcpm.c
|
|
index 59d4fa2..0451441 100644
|
|
--- a/drivers/usb/typec/tcpm/tcpm.c
|
|
+++ b/drivers/usb/typec/tcpm/tcpm.c
|
|
@@ -776,7 +776,7 @@ static void tcpm_debugfs_exit(const struct tcpm_port *port) { }
|
|
|
|
static void tcpm_set_cc(struct tcpm_port *port, enum typec_cc_status cc)
|
|
{
|
|
- tcpm_log(port, "cc:=%d", cc);
|
|
+ //tcpm_log(port, "cc:=%d", cc);
|
|
port->cc_req = cc;
|
|
port->tcpc->set_cc(port->tcpc, cc);
|
|
}
|
|
@@ -869,10 +869,12 @@ static int tcpm_pd_transmit(struct tcpm_port *port,
|
|
unsigned long timeout;
|
|
int ret;
|
|
|
|
+ /*
|
|
if (msg)
|
|
tcpm_log(port, "PD TX, header: %#x", le16_to_cpu(msg->header));
|
|
else
|
|
tcpm_log(port, "PD TX, type: %#x", type);
|
|
+ */
|
|
|
|
reinit_completion(&port->tx_complete);
|
|
ret = port->tcpc->pd_transmit(port->tcpc, type, msg, port->negotiated_rev);
|
|
@@ -918,7 +920,7 @@ static int tcpm_pd_transmit(struct tcpm_port *port,
|
|
void tcpm_pd_transmit_complete(struct tcpm_port *port,
|
|
enum tcpm_transmit_status status)
|
|
{
|
|
- tcpm_log(port, "PD TX complete, status: %u", status);
|
|
+ //tcpm_log(port, "PD TX complete, status: %u", status);
|
|
port->tx_status = status;
|
|
complete(&port->tx_complete);
|
|
}
|
|
@@ -951,7 +953,7 @@ static int tcpm_set_polarity(struct tcpm_port *port,
|
|
{
|
|
int ret;
|
|
|
|
- tcpm_log(port, "polarity %d", polarity);
|
|
+ //tcpm_log(port, "polarity %d", polarity);
|
|
|
|
ret = port->tcpc->set_polarity(port->tcpc, polarity);
|
|
if (ret < 0)
|
|
@@ -966,7 +968,7 @@ static int tcpm_set_vconn(struct tcpm_port *port, bool enable)
|
|
{
|
|
int ret;
|
|
|
|
- tcpm_log(port, "vconn:=%d", enable);
|
|
+ //tcpm_log(port, "vconn:=%d", enable);
|
|
|
|
ret = port->tcpc->set_vconn(port->tcpc, enable);
|
|
if (!ret) {
|
|
@@ -2871,8 +2873,8 @@ static void tcpm_pd_rx_handler(struct kthread_work *work)
|
|
|
|
mutex_lock(&port->lock);
|
|
|
|
- tcpm_log(port, "PD RX, header: %#x [%d]", le16_to_cpu(msg->header),
|
|
- port->attached);
|
|
+ //tcpm_log(port, "PD RX, header: %#x [%d]", le16_to_cpu(msg->header),
|
|
+ //port->attached);
|
|
|
|
if (port->attached) {
|
|
enum pd_ctrl_msg_type type = pd_header_type_le(msg->header);
|
|
@@ -5041,7 +5043,7 @@ static void _tcpm_cc_change(struct tcpm_port *port, enum typec_cc_status cc1,
|
|
|
|
static void _tcpm_pd_vbus_on(struct tcpm_port *port)
|
|
{
|
|
- tcpm_log_force(port, "VBUS on");
|
|
+ tcpm_log_force(port, "VBUS event received: on");
|
|
port->vbus_present = true;
|
|
/*
|
|
* When vbus_present is true i.e. Voltage at VBUS is greater than VSAFE5V implicitly
|
|
@@ -5131,7 +5133,7 @@ static void _tcpm_pd_vbus_on(struct tcpm_port *port)
|
|
|
|
static void _tcpm_pd_vbus_off(struct tcpm_port *port)
|
|
{
|
|
- tcpm_log_force(port, "VBUS off");
|
|
+ tcpm_log_force(port, "VBUS event received: off");
|
|
port->vbus_present = false;
|
|
port->vbus_never_low = false;
|
|
switch (port->state) {
|