summaryrefslogtreecommitdiff
path: root/zephyr/projects/herobrine/adc.dts
diff options
context:
space:
mode:
Diffstat (limited to 'zephyr/projects/herobrine/adc.dts')
-rw-r--r--zephyr/projects/herobrine/adc.dts47
1 files changed, 47 insertions, 0 deletions
diff --git a/zephyr/projects/herobrine/adc.dts b/zephyr/projects/herobrine/adc.dts
new file mode 100644
index 0000000000..16a5434e9d
--- /dev/null
+++ b/zephyr/projects/herobrine/adc.dts
@@ -0,0 +1,47 @@
+/* Copyright 2022 The ChromiumOS Authors
+ * Use of this source code is governed by a BSD-style license that can be
+ * found in the LICENSE file.
+ */
+
+#include <zephyr/dt-bindings/adc/adc.h>
+
+/ {
+ named-adc-channels {
+ compatible = "named-adc-channels";
+
+ vbus {
+ enum-name = "ADC_VBUS";
+ io-channels = <&adc0 1>;
+ /* Measure VBUS through a 1/10 voltage divider */
+ mul = <10>;
+ };
+ amon_bmon {
+ enum-name = "ADC_AMON_BMON";
+ io-channels = <&adc0 2>;
+ /*
+ * Adapter current output or battery charging/
+ * discharging current (uV) 18x amplification on
+ * charger side.
+ */
+ mul = <1000>;
+ div = <18>;
+ };
+ psys {
+ enum-name = "ADC_PSYS";
+ io-channels = <&adc0 3>;
+ /*
+ * ISL9238 PSYS output is 1.44 uA/W over 5.6K resistor,
+ * to read 0.8V @ 99 W, i.e. 124000 uW/mV.
+ */
+ mul = <124000>;
+ };
+ };
+};
+
+&adc0 {
+ status = "okay";
+ pinctrl-0 = <&adc0_chan1_gp44
+ &adc0_chan2_gp43
+ &adc0_chan3_gp42>;
+ pinctrl-names = "default";
+};