mirror of
https://github.com/Telecominfraproject/OpenCellular.git
synced 2025-12-28 02:35:28 +00:00
Analogix: Present configured Rp pull-up.
ANX was using 36K Rp detection as default detect value.
ANX fix google issue google charger
BUG=chrome-os-partner:54452
BRANCH=master
TEST=On Reef: With twinkie tested CC voltage change for
1.5A Rp pull up meets the spec values.
Change-Id: I3af20e5c437218b83befc899a7c62b019b2c9dee
Signed-off-by: Tang Zhentian1 <ztang@analogixsemi.com>
Signed-off-by: Divya Sasidharan <divya.s.sasidharan@intel.com>
Reviewed-on: https://chromium-review.googlesource.com/366461
Commit-Ready: Divya S Sasidharan <divya.s.sasidharan@intel.com>
Tested-by: Kevin K Wong <kevin.k.wong@intel.com>
Reviewed-by: David Hendricks <dhendrix@chromium.org>
Reviewed-by: Kevin K Wong <kevin.k.wong@intel.com>
This commit is contained in:
committed by
chrome-bot
parent
6b6ed79a56
commit
2e738c72fd
@@ -51,6 +51,7 @@
|
||||
#define CONFIG_USB_PD_TCPM_ANX74XX
|
||||
#define CONFIG_USB_PD_TCPM_PS8751
|
||||
#define CONFIG_USB_PD_TCPM_TCPCI
|
||||
#define CONFIG_USB_PD_VBUS_DETECT_TCPC
|
||||
#define CONFIG_USB_PD_TRY_SRC
|
||||
#define CONFIG_USB_POWER_DELIVERY
|
||||
|
||||
|
||||
@@ -552,6 +552,7 @@ static int anx74xx_alert_status(int port, int *alert)
|
||||
rv = tcpc_read(port, ANX74XX_REG_IRQ_SOURCE_RECV_MSG, ®);
|
||||
if (rv)
|
||||
return EC_ERROR_UNKNOWN;
|
||||
rv |= tcpc_write(port, ANX74XX_REG_IRQ_SOURCE_RECV_MSG, 0);
|
||||
|
||||
if (reg & ANX74XX_REG_IRQ_CC_MSG_INT)
|
||||
*alert |= ANX74XX_REG_ALERT_MSG_RECV;
|
||||
@@ -560,24 +561,18 @@ static int anx74xx_alert_status(int port, int *alert)
|
||||
|
||||
if (reg & ANX74XX_REG_IRQ_CC_STATUS_INT) {
|
||||
*alert |= ANX74XX_REG_ALERT_CC_CHANGE;
|
||||
rv |= tcpc_write(port, ANX74XX_REG_IRQ_SOURCE_RECV_MSG,
|
||||
reg & 0xfd);
|
||||
} else {
|
||||
*alert &= (~ANX74XX_REG_ALERT_CC_CHANGE);
|
||||
}
|
||||
|
||||
if (reg & ANX74XX_REG_IRQ_GOOD_CRC_INT) {
|
||||
*alert |= ANX74XX_REG_ALERT_TX_ACK_RECV;
|
||||
rv |= tcpc_write(port, ANX74XX_REG_IRQ_SOURCE_RECV_MSG,
|
||||
reg & 0xfb);
|
||||
} else {
|
||||
*alert &= (~ANX74XX_REG_ALERT_TX_ACK_RECV);
|
||||
}
|
||||
|
||||
if (reg & ANX74XX_REG_IRQ_TX_FAIL_INT) {
|
||||
*alert |= ANX74XX_REG_ALERT_TX_MSG_ERROR;
|
||||
rv |= tcpc_write(port, ANX74XX_REG_IRQ_SOURCE_RECV_MSG,
|
||||
reg & 0xf7);
|
||||
}
|
||||
/* Read TCPC Alert register2 */
|
||||
rv |= tcpc_read(port, ANX74XX_REG_IRQ_EXT_SOURCE_2, ®);
|
||||
@@ -605,6 +600,25 @@ static int anx74xx_tcpm_set_rx_enable(int port, int enable)
|
||||
anx74xx_tcpm_set_auto_good_crc(port, enable);
|
||||
rv |= tcpc_write(port, ANX74XX_REG_IRQ_SOURCE_RECV_MSG_MASK, reg);
|
||||
|
||||
/* patch for Rp 36K issue */
|
||||
rv |= tcpc_read(port, ANX74XX_REG_ANALOG_CTRL_6, ®);
|
||||
if (rv)
|
||||
return EC_ERROR_UNKNOWN;
|
||||
|
||||
/* clear Bit[0,1] R_RP to default Rp's value */
|
||||
reg &= ~0x03;
|
||||
|
||||
if (enable) {
|
||||
#ifdef CONFIG_USB_PD_PULLUP_1_5A
|
||||
/* Set Rp strength to 12K for presenting 1.5A */
|
||||
reg |= ANX74XX_REG_CC_PULL_RP_12K;
|
||||
#elif defined(CONFIG_USB_PD_PULLUP_3A)
|
||||
/* Set Rp strength to 4K for presenting 3A */
|
||||
reg |= ANX74XX_REG_CC_PULL_RP_4K;
|
||||
#endif
|
||||
}
|
||||
rv |= tcpc_write(port, ANX74XX_REG_ANALOG_CTRL_6, reg);
|
||||
|
||||
return rv;
|
||||
}
|
||||
|
||||
|
||||
@@ -55,6 +55,7 @@
|
||||
#define ANX74XX_REG_CC_PULL_RD 0xfd
|
||||
#define ANX74XX_REG_CC_PULL_RP 0x02
|
||||
|
||||
|
||||
#define ANX74XX_REG_TX_AUTO_GOODCRC_1 0x9c
|
||||
#define ANX74XX_REG_TX_AUTO_GOODCRC_2 0x94
|
||||
#define ANX74XX_REG_AUTO_GOODCRC_EN 0x01
|
||||
@@ -62,6 +63,11 @@
|
||||
|
||||
#define ANX74XX_REG_ANALOG_CTRL_1 0x42
|
||||
#define ANX74XX_REG_ANALOG_CTRL_5 0x46
|
||||
#define ANX74XX_REG_ANALOG_CTRL_6 0x47
|
||||
#define ANX74XX_REG_CC_PULL_RP_36K 0x00
|
||||
#define ANX74XX_REG_CC_PULL_RP_12K 0x01
|
||||
#define ANX74XX_REG_CC_PULL_RP_4K 0x02
|
||||
|
||||
#define ANX74XX_REG_R_SWITCH_CC_CLR 0x0f
|
||||
#define ANX74XX_REG_R_SWITCH_CC2_SET 0x10
|
||||
#define ANX74XX_REG_R_SWITCH_CC1_SET 0x20
|
||||
|
||||
Reference in New Issue
Block a user