summaryrefslogtreecommitdiff
path: root/src/lib
diff options
context:
space:
mode:
Diffstat (limited to 'src/lib')
-rw-r--r--src/lib/Makefile.inc1
-rw-r--r--src/lib/dp_aux.c41
2 files changed, 42 insertions, 0 deletions
diff --git a/src/lib/Makefile.inc b/src/lib/Makefile.inc
index 693a526b66..0f96aebd7e 100644
--- a/src/lib/Makefile.inc
+++ b/src/lib/Makefile.inc
@@ -147,6 +147,7 @@ ramstage-$(CONFIG_BOOTSPLASH) += bootsplash.c
ramstage-$(CONFIG_BOOTSPLASH) += jpeg.c
ramstage-$(CONFIG_COLLECT_TIMESTAMPS) += timestamp.c
ramstage-$(CONFIG_COVERAGE) += libgcov.c
+ramstage-y += dp_aux.c
ramstage-y += edid.c
ramstage-y += edid_fill_fb.c
ramstage-y += memrange.c
diff --git a/src/lib/dp_aux.c b/src/lib/dp_aux.c
new file mode 100644
index 0000000000..ee3ac8ab00
--- /dev/null
+++ b/src/lib/dp_aux.c
@@ -0,0 +1,41 @@
+/* SPDX-License-Identifier: GPL-2.0-only */
+
+#include <delay.h>
+#include <dp_aux.h>
+#include <console/console.h>
+#include <timer.h>
+
+bool dp_aux_request_is_write(enum aux_request request)
+{
+ switch (request) {
+ case I2C_RAW_WRITE_AND_STOP:
+ case I2C_RAW_WRITE:
+ case DPCD_WRITE:
+ return true;
+ default:
+ return false;
+ }
+}
+
+enum i2c_over_aux dp_get_aux_cmd(enum aux_request request, uint32_t remaining_after_this)
+{
+ switch (request) {
+ case I2C_RAW_WRITE_AND_STOP:
+ if (!remaining_after_this)
+ return I2C_OVER_AUX_WRITE_MOT_0;
+ /* fallthrough */
+ case I2C_RAW_WRITE:
+ return I2C_OVER_AUX_WRITE_MOT_1;
+ case I2C_RAW_READ_AND_STOP:
+ if (!remaining_after_this)
+ return I2C_OVER_AUX_READ_MOT_0;
+ /* fallthrough */
+ case I2C_RAW_READ:
+ return I2C_OVER_AUX_READ_MOT_1;
+ case DPCD_WRITE:
+ return NATIVE_AUX_WRITE;
+ case DPCD_READ:
+ default:
+ return NATIVE_AUX_READ;
+ }
+}