summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorScott Collyer <scollyer@google.com>2023-03-21 14:13:55 -0700
committerChromeos LUCI <chromeos-scoped@luci-project-accounts.iam.gserviceaccount.com>2023-04-26 04:04:45 +0000
commit0330a72acf5a36c729f853db24bf8a3361e5f60c (patch)
tree8afd8e58e870560d2fa0e898b2c86bed5211ab14
parentcc77132214314039ac2c14db1e73b8859d26e690 (diff)
downloadchrome-ec-0330a72acf5a36c729f853db24bf8a3361e5f60c.tar.gz
driver: shim: Port KTU1125 PPC driver to Zephyr
This CL adds the shim layer required to support the KTU1125 PPC driver. BUG=b:267589112 BRANCH=None TEST=zmake build rex Verified basic type-c/PD operation on SKU2 system Change-Id: Ie8b83910ce60c0e3f276a7b3086f9b9c708bdaf7 Signed-off-by: Scott Collyer <scollyer@google.com> Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/ec/+/4358755 Reviewed-by: Boris Mittelberg <bmbm@google.com> Tested-by: Boris Mittelberg <bmbm@google.com> Commit-Queue: caveh jalali <caveh@chromium.org>
-rw-r--r--zephyr/dts/bindings/usbc/ppc/kinetic,ktu1125.yaml5
-rw-r--r--zephyr/shim/include/usbc/ppc.h2
-rw-r--r--zephyr/shim/include/usbc/ppc_ktu1125.h14
-rw-r--r--zephyr/shim/src/ppc.c4
4 files changed, 25 insertions, 0 deletions
diff --git a/zephyr/dts/bindings/usbc/ppc/kinetic,ktu1125.yaml b/zephyr/dts/bindings/usbc/ppc/kinetic,ktu1125.yaml
new file mode 100644
index 0000000000..104d81e340
--- /dev/null
+++ b/zephyr/dts/bindings/usbc/ppc/kinetic,ktu1125.yaml
@@ -0,0 +1,5 @@
+description: USBC PPC
+
+compatible: "kinetic,ktu1125"
+
+include: ["i2c-device.yaml", "ppc-chip.yaml"]
diff --git a/zephyr/shim/include/usbc/ppc.h b/zephyr/shim/include/usbc/ppc.h
index 98e9c3f728..5889755bd2 100644
--- a/zephyr/shim/include/usbc/ppc.h
+++ b/zephyr/shim/include/usbc/ppc.h
@@ -7,6 +7,7 @@
#define ZEPHYR_CHROME_USBC_PPC_H
#include "usbc/ppc_aoz1380.h"
+#include "usbc/ppc_ktu1125.h"
#include "usbc/ppc_nx20p348x.h"
#include "usbc/ppc_rt1739.h"
#include "usbc/ppc_sn5s330.h"
@@ -61,6 +62,7 @@
* "is-alt" property set.
*/
DT_FOREACH_STATUS_OKAY(AOZ1380_COMPAT, PPC_ALT_DECLARE)
+DT_FOREACH_STATUS_OKAY(KTU1125_COMPAT, PPC_ALT_DECLARE)
DT_FOREACH_STATUS_OKAY(NX20P348X_COMPAT, PPC_ALT_DECLARE)
DT_FOREACH_STATUS_OKAY(RT1739_PPC_COMPAT, PPC_ALT_DECLARE)
DT_FOREACH_STATUS_OKAY(SN5S330_COMPAT, PPC_ALT_DECLARE)
diff --git a/zephyr/shim/include/usbc/ppc_ktu1125.h b/zephyr/shim/include/usbc/ppc_ktu1125.h
new file mode 100644
index 0000000000..4ca7caca83
--- /dev/null
+++ b/zephyr/shim/include/usbc/ppc_ktu1125.h
@@ -0,0 +1,14 @@
+/* Copyright 2023 The ChromiumOS Authors
+ * Use of this source code is governed by a BSD-style license that can be
+ * found in the LICENSE file.
+ */
+
+#include "ppc/ktu1125_public.h"
+
+#define KTU1125_COMPAT kinetic_ktu1125
+
+#define PPC_CHIP_KTU1125(id) \
+ { \
+ .i2c_port = I2C_PORT_BY_DEV(id), \
+ .i2c_addr_flags = DT_REG_ADDR(id), .drv = &ktu1125_drv, \
+ }
diff --git a/zephyr/shim/src/ppc.c b/zephyr/shim/src/ppc.c
index c25daf5392..ec5f2f26e1 100644
--- a/zephyr/shim/src/ppc.c
+++ b/zephyr/shim/src/ppc.c
@@ -5,6 +5,7 @@
#include "usbc/ppc.h"
#include "usbc/ppc_aoz1380.h"
+#include "usbc/ppc_ktu1125.h"
#include "usbc/ppc_nx20p348x.h"
#include "usbc/ppc_rt1739.h"
#include "usbc/ppc_sn5s330.h"
@@ -14,6 +15,7 @@
#include <zephyr/devicetree.h>
#if DT_HAS_COMPAT_STATUS_OKAY(AOZ1380_COMPAT) || \
+ DT_HAS_COMPAT_STATUS_OKAY(KTU1125_COMPAT) || \
DT_HAS_COMPAT_STATUS_OKAY(NX20P348X_COMPAT) || \
DT_HAS_COMPAT_STATUS_OKAY(RT1739_PPC_COMPAT) || \
DT_HAS_COMPAT_STATUS_OKAY(SN5S330_COMPAT) || \
@@ -30,6 +32,7 @@
#define PPC_CHIP_FIND(usbc_id, ppc_id) \
CHECK_COMPAT(AOZ1380_COMPAT, usbc_id, ppc_id, PPC_CHIP_AOZ1380) \
+ CHECK_COMPAT(KTU1125_COMPAT, usbc_id, ppc_id, PPC_CHIP_KTU1125) \
CHECK_COMPAT(NX20P348X_COMPAT, usbc_id, ppc_id, PPC_CHIP_NX20P348X) \
CHECK_COMPAT(RT1739_PPC_COMPAT, usbc_id, ppc_id, PPC_CHIP_RT1739) \
CHECK_COMPAT(SN5S330_COMPAT, usbc_id, ppc_id, PPC_CHIP_SN5S330) \
@@ -66,6 +69,7 @@ struct ppc_config_t ppc_chips_alt[] = { DT_FOREACH_STATUS_OKAY(named_usbc_port,
* "is-alt" property set.
*/
DT_FOREACH_STATUS_OKAY_VARGS(AOZ1380_COMPAT, PPC_ALT_DEFINE, PPC_CHIP_AOZ1380)
+DT_FOREACH_STATUS_OKAY_VARGS(KTU1125_COMPAT, PPC_ALT_DEFINE, PPC_CHIP_KTU1125)
DT_FOREACH_STATUS_OKAY_VARGS(NX20P348X_COMPAT, PPC_ALT_DEFINE,
PPC_CHIP_NX20P348X)
DT_FOREACH_STATUS_OKAY_VARGS(RT1739_PPC_COMPAT, PPC_ALT_DEFINE, PPC_CHIP_RT1739)