summaryrefslogtreecommitdiff
path: root/driver/retimer/ps8811.h
diff options
context:
space:
mode:
authorRob Barnes <robbarnes@google.com>2021-06-07 14:53:59 -0600
committerCommit Bot <commit-bot@chromium.org>2021-06-14 21:33:03 +0000
commit592ef1dafdd59629df85b9852fbb629c0323acd6 (patch)
treec31dc2bf908939e9b7816903c3f4775f84d54aca /driver/retimer/ps8811.h
parent417c1411ed94cdbc27e99a3ca829b786b9a4ec4e (diff)
downloadchrome-ec-592ef1dafdd59629df85b9852fbb629c0323acd6.tar.gz
guybrush: Add PS8811 driver
Add PS8811 USB A retimer driver. Reusing USB mux structure even though the retimer does not have a mux. BUG=b:176987937 TEST=Build and run BRANCH=None Signed-off-by: Rob Barnes <robbarnes@google.com> Change-Id: Ie11a105f344e6acc1312cda517fdfe54ecb8c8ea Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/ec/+/2946307 Commit-Queue: Diana Z <dzigterman@chromium.org> Reviewed-by: Diana Z <dzigterman@chromium.org>
Diffstat (limited to 'driver/retimer/ps8811.h')
-rw-r--r--driver/retimer/ps8811.h42
1 files changed, 39 insertions, 3 deletions
diff --git a/driver/retimer/ps8811.h b/driver/retimer/ps8811.h
index 03cf8f604e..81b84d32e5 100644
--- a/driver/retimer/ps8811.h
+++ b/driver/retimer/ps8811.h
@@ -5,6 +5,8 @@
* PS8811 retimer.
*/
+#include "usb_mux.h"
+
#ifndef __CROS_EC_USB_RETIMER_PS8811_H
#define __CROS_EC_USB_RETIMER_PS8811_H
@@ -26,9 +28,9 @@
/*
* PAGE 1 Register Definitions
*/
-#define PS8811_REG_PAGE1 0x01
+#define PS8811_REG_PAGE1 0x01
-#define PS8811_REG1_USB_BEQ_LEVEL 0x05
+#define PS8811_REG1_USB_BEQ_LEVEL 0x05
#define PS8811_BEQ_PIN_LEVEL_UP_9DB 0x00
#define PS8811_BEQ_PIN_LEVEL_UP_10_5DB 0x01
#define PS8811_BEQ_PIN_LEVEL_UP_12DB 0x02
@@ -52,8 +54,42 @@
#define PS8811_BEQ_I2C_LEVEL_UP_21DB 0x90
#define PS8811_BEQ_I2C_LEVEL_UP_23DB 0xA0
-#define PS8811_REG1_USB_BEQ_CONFIG 0x06
+#define PS8811_REG1_USB_BEQ_CONFIG 0x06
#define PS8811_BEQ_CONFIG_REG_ENABLE BIT(0)
+#define PS8811_REG1_USB_CHAN_A_SWING 0x66
+#define PS8811_CHAN_A_SWING_MASK GENMASK(6, 4)
+#define PS8811_CHAN_A_SWING_SHIFT 4
+
+#define PS8811_REG1_USB_CHAN_B_SWING 0xA4
+#define PS8811_CHAN_B_SWING_MASK GENMASK(2, 0)
+#define PS8811_CHAN_B_SWING_SHIFT 0
+
+/* De-emphasis -2.2 dB, Pre-shoot 1.2 dB */
+#define PS8811_CHAN_B_DE_2_2_PS_1_2_LSB 0x1
+#define PS8811_CHAN_B_DE_2_2_PS_1_2_MSB 0x13
+
+/* De-emphasis -3.5 dB, Pre-shoot 0 dB */
+#define PS8811_CHAN_B_DE_3_5_PS_0_LSB 0x0
+#define PS8811_CHAN_B_DE_3_5_PS_0_MSB 0x5
+
+/* De-emphasis -4.5 dB, Pre-shoot 0 dB */
+#define PS8811_CHAN_B_DE_4_5_PS_0_LSB 0x0
+#define PS8811_CHAN_B_DE_4_5_PS_0_MSB 0x6
+
+/* De-emphasis -6 dB, Pre-shoot 3 dB */
+#define PS8811_CHAN_B_DE_6_PS_3_LSB 0x4
+#define PS8811_CHAN_B_DE_6_PS_3_MSB 0x16
+
+#define PS8811_REG1_USB_CHAN_B_DE_PS_LSB 0xA5
+#define PS8811_CHAN_B_DE_PS_LSB_MASK GENMASK(2, 0)
+
+#define PS8811_REG1_USB_CHAN_B_DE_PS_MSB 0xA6
+#define PS8811_CHAN_B_DE_PS_MSB_MASK GENMASK(5, 0)
+
+int ps8811_i2c_read(const struct usb_mux *me, int page, int offset, int *data);
+int ps8811_i2c_write(const struct usb_mux *me, int page, int offset, int data);
+int ps8811_i2c_field_update(const struct usb_mux *me, int page, int offset,
+ uint8_t field_mask, uint8_t set_value);
#endif /* __CROS_EC_USB_RETIMER_PS8802_H */