summaryrefslogtreecommitdiff
path: root/zephyr/program/herobrine/adc.dtsi
blob: 16a5434e9dee0b9cfd4136c803caa54793e03e1b (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
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";
};