summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMichael5 Chen <michael5_chen1@pegatron.corp-partner.google.com>2020-11-26 15:54:16 +0800
committerCommit Bot <commit-bot@chromium.org>2020-12-07 19:59:01 +0000
commit9519eb83f1ae7ff09c2e87b2344072773bb17259 (patch)
treecb7e6ebeb9961e61b706aa92ca05bbb9210874e5
parent8405cbe461ad133aecbb9418b2d12e62f5e10277 (diff)
downloadchrome-ec-9519eb83f1ae7ff09c2e87b2344072773bb17259.tar.gz
delbin: Initial PS8811 registers.
Depend on b/160937185 #32, initial PS8811 registers. BUG=b:160937185 BRANCH=firmware-volteer-13521.B TEST=manual Check register value under s0. Signed-off-by: Michael5 Chen <michael5_chen1@pegatron.corp-partner.google.com> Change-Id: I262858b61050f9ad857f44e703bbd3cfd0e989f0 Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/ec/+/2561904 Reviewed-by: Jacky Wang <jacky5_wang@pegatron.corp-partner.google.com> Reviewed-by: Keith Short <keithshort@chromium.org> Commit-Queue: Keith Short <keithshort@chromium.org>
-rw-r--r--board/delbin/board.c29
-rw-r--r--board/trembyle/board.c4
-rw-r--r--board/woomax/board.c2
-rw-r--r--driver/retimer/ps8811.h11
4 files changed, 42 insertions, 4 deletions
diff --git a/board/delbin/board.c b/board/delbin/board.c
index 1c712724bc..cb58616607 100644
--- a/board/delbin/board.c
+++ b/board/delbin/board.c
@@ -12,6 +12,7 @@
#include "driver/accelgyro_bmi260.h"
#include "driver/bc12/pi3usb9201.h"
#include "driver/ppc/syv682x.h"
+#include "driver/retimer/ps8811.h"
#include "driver/tcpm/ps8xxx.h"
#include "driver/tcpm/tcpci.h"
#include "driver/tcpm/tusb422.h"
@@ -342,6 +343,34 @@ __override const struct ec_response_keybd_config
return &delbin_kb;
}
+static void ps8811_init(void)
+{
+ int rv;
+
+ /* Set Channel A output swing to Level1 */
+ rv = i2c_write8(I2C_PORT_USB_1_MIX,
+ PS8811_I2C_ADDR_FLAGS0 + PS8811_REG_PAGE1, 0x66, 0x10);
+ /* Set 50 ohm termination adjuct for B channel: -9%*/
+ rv |= i2c_write8(I2C_PORT_USB_1_MIX,
+ PS8811_I2C_ADDR_FLAGS0 + PS8811_REG_PAGE1, 0x73, 0x04);
+ /* Set Channel B output swing to Level3 */
+ rv |= i2c_write8(I2C_PORT_USB_1_MIX,
+ PS8811_I2C_ADDR_FLAGS0 + PS8811_REG_PAGE1, 0xA4, 0x03);
+ /* Set PS level for B channel */
+ rv |= i2c_write8(I2C_PORT_USB_1_MIX,
+ PS8811_I2C_ADDR_FLAGS0 + PS8811_REG_PAGE1, 0xA5, 0x84);
+ /* Set DE level for B channel */
+ rv |= i2c_write8(I2C_PORT_USB_1_MIX,
+ PS8811_I2C_ADDR_FLAGS0 + PS8811_REG_PAGE1, 0xA6, 0x16);
+}
+
+/* Called on AP S5 -> S0ix transition */
+static void board_chipset_startup(void)
+{
+ ps8811_init();
+}
+DECLARE_HOOK(HOOK_CHIPSET_STARTUP, board_chipset_startup, HOOK_PRIO_DEFAULT);
+
/* Called on AP S0ix -> S0 transition */
static void board_chipset_resume(void)
{
diff --git a/board/trembyle/board.c b/board/trembyle/board.c
index 1384107732..31bac3b276 100644
--- a/board/trembyle/board.c
+++ b/board/trembyle/board.c
@@ -210,7 +210,7 @@ static void board_chipset_resume(void)
int val;
rv = i2c_read8(I2C_PORT_USBA0,
- PS8811_I2C_ADDR_FLAGS + PS8811_REG_PAGE1,
+ PS8811_I2C_ADDR_FLAGS3 + PS8811_REG_PAGE1,
PS8811_REG1_USB_BEQ_LEVEL, &val);
if (!rv)
break;
@@ -223,7 +223,7 @@ static void board_chipset_resume(void)
/* USB-A1 needs to increase gain to get over MB/DB connector */
for (retry = 0; retry < PS8811_ACCESS_RETRIES; ++retry) {
rv = i2c_write8(I2C_PORT_USBA1,
- PS8811_I2C_ADDR_FLAGS + PS8811_REG_PAGE1,
+ PS8811_I2C_ADDR_FLAGS3 + PS8811_REG_PAGE1,
PS8811_REG1_USB_BEQ_LEVEL,
PS8811_BEQ_I2C_LEVEL_UP_13DB |
PS8811_BEQ_PIN_LEVEL_UP_18DB);
diff --git a/board/woomax/board.c b/board/woomax/board.c
index bb212bface..1fd0dcd39b 100644
--- a/board/woomax/board.c
+++ b/board/woomax/board.c
@@ -224,7 +224,7 @@ static void board_chipset_resume(void)
int val;
rv = i2c_read8(I2C_PORT_USBA0,
- PS8811_I2C_ADDR_FLAGS + PS8811_REG_PAGE1,
+ PS8811_I2C_ADDR_FLAGS3 + PS8811_REG_PAGE1,
PS8811_REG1_USB_BEQ_LEVEL, &val);
if (!rv)
break;
diff --git a/driver/retimer/ps8811.h b/driver/retimer/ps8811.h
index 13a83c045d..03cf8f604e 100644
--- a/driver/retimer/ps8811.h
+++ b/driver/retimer/ps8811.h
@@ -9,10 +9,19 @@
#define __CROS_EC_USB_RETIMER_PS8811_H
/*
+ * PS8811 uses 7-bit I2C addresses 0x28 to 0x29 (ADDR=LL).
+ * Page 0 = 0x28, Page 1 = 0x29.
+ * PS8811 uses 7-bit I2C addresses 0x2A to 0x2B (ADDR=LH).
+ * Page 0 = 0x2A, Page 1 = 0x2B.
+ * PS8811 uses 7-bit I2C addresses 0x70 to 0x71 (ADDR=HL).
+ * Page 0 = 0x70, Page 1 = 0x71.
* PS8811 uses 7-bit I2C addresses 0x72 to 0x73 (ADDR=HH).
* Page 0 = 0x72, Page 1 = 0x73.
*/
-#define PS8811_I2C_ADDR_FLAGS 0x72
+#define PS8811_I2C_ADDR_FLAGS0 0x28
+#define PS8811_I2C_ADDR_FLAGS1 0x2A
+#define PS8811_I2C_ADDR_FLAGS2 0x70
+#define PS8811_I2C_ADDR_FLAGS3 0x72
/*
* PAGE 1 Register Definitions