summaryrefslogtreecommitdiff
path: root/driver/retimer
diff options
context:
space:
mode:
authorDiana Z <dzigterman@chromium.org>2022-06-03 16:59:05 -0600
committerChromeos LUCI <chromeos-scoped@luci-project-accounts.iam.gserviceaccount.com>2022-06-07 16:30:07 +0000
commitf82d96d6a690aaaf7222a6200c02fdc34614ca7f (patch)
treea30545eca7f404d75a04ab79a455ec6bf7362c38 /driver/retimer
parent38b9c4b824f34b3aa81f2399ce91b88077197d52 (diff)
downloadchrome-ec-f82d96d6a690aaaf7222a6200c02fdc34614ca7f.tar.gz
ANX7483: Add EQ tuning interface
Add an API which may be used to adjust the EQ settings of pins on the retimer individually. BRANCH=None BUG=b:230694492 TEST=zmake testall Signed-off-by: Diana Z <dzigterman@chromium.org> Change-Id: I26ddb01cb3d84ef074545d05a5836ad6e385ed92 Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/ec/+/3689783 Reviewed-by: Peter Marheine <pmarheine@chromium.org>
Diffstat (limited to 'driver/retimer')
-rw-r--r--driver/retimer/anx7483.c29
-rw-r--r--driver/retimer/anx7483.h3
2 files changed, 32 insertions, 0 deletions
diff --git a/driver/retimer/anx7483.c b/driver/retimer/anx7483.c
index 2add843611..6804fd3de8 100644
--- a/driver/retimer/anx7483.c
+++ b/driver/retimer/anx7483.c
@@ -6,6 +6,7 @@
*/
#include "anx7483.h"
+#include "retimer/anx7483_public.h"
#include "chipset.h"
#include "common.h"
#include "console.h"
@@ -315,6 +316,34 @@ enum ec_error_list anx7483_set_default_tuning(const struct usb_mux *me,
return EC_SUCCESS;
}
+enum ec_error_list anx7483_set_eq(const struct usb_mux *me,
+ enum anx7483_tune_pin pin,
+ enum anx7483_eq_setting eq)
+{
+ int reg, value;
+
+ if (pin == ANX7483_PIN_UTX1)
+ reg = ANX7483_UTX1_PORT_CFG0_REG;
+ else if (pin == ANX7483_PIN_UTX2)
+ reg = ANX7483_UTX2_PORT_CFG0_REG;
+ else if (pin == ANX7483_PIN_URX1)
+ reg = ANX7483_URX1_PORT_CFG0_REG;
+ else if (pin == ANX7483_PIN_URX2)
+ reg = ANX7483_URX2_PORT_CFG0_REG;
+ else if (pin == ANX7483_PIN_DRX1)
+ reg = ANX7483_DRX1_PORT_CFG0_REG;
+ else if (pin == ANX7483_PIN_DRX2)
+ reg = ANX7483_DRX2_PORT_CFG0_REG;
+ else
+ return EC_ERROR_INVAL;
+
+ RETURN_ERROR(anx7483_read(me, reg, &value));
+ value &= ~ANX7483_CFG0_EQ_MASK;
+ value |= eq << ANX7483_CFG0_EQ_SHIFT;
+
+ return anx7483_write(me, reg, value);
+}
+
const struct usb_mux_driver anx7483_usb_retimer_driver = {
.init = anx7483_init,
.set = anx7483_set,
diff --git a/driver/retimer/anx7483.h b/driver/retimer/anx7483.h
index 2caf007a03..d5f6723818 100644
--- a/driver/retimer/anx7483.h
+++ b/driver/retimer/anx7483.h
@@ -50,6 +50,9 @@
#define ANX7483_DRX1_PORT_CFG0_REG 0x5C
#define ANX7483_DRX2_PORT_CFG0_REG 0x20
+#define ANX7483_CFG0_EQ_SHIFT 4
+#define ANX7483_CFG0_EQ_MASK GENMASK(7, 4)
+
/*
* Default CFG0 value to apply: 9.2 dB with optimized tuning step
*/