summaryrefslogtreecommitdiff
path: root/chip/it83xx/adc_chip.h
diff options
context:
space:
mode:
authorDino Li <dino.li@ite.com.tw>2014-12-03 17:28:42 +0800
committerchrome-internal-fetch <chrome-internal-fetch@google.com>2014-12-19 09:17:27 +0000
commit165cf6c8813420e1ce525e103b42f19017228ec6 (patch)
treeae6722100c5f3d6207fcf206645df2b25ed06654 /chip/it83xx/adc_chip.h
parent7ec2e4158af7d5564038bc4b0336653445ba08c5 (diff)
downloadchrome-ec-165cf6c8813420e1ce525e103b42f19017228ec6.tar.gz
it8380dev: add adc control module
Add adc control module for emulation board. The ADC converts the input voltage signal ranging from 0v to 3v into a 10-bit unsigned integer. Signed-off-by: Dino Li <dino.li@ite.com.tw> BRANCH=none BUG=none TEST=manual test. 1 - adc channel 1, 3, 5, and 7 to ground. 2 - adc channel 0 and 2 to 1.26v. 3 - adc channel 4 and 6 to 1.72v. 4 - condition, factor_mul = 3000, factor_div = 1024, and shift = 0. 5 - console "adc", result as following. adc_ch0 = 1256 adc_ch1 = 0 adc_ch2 = 1256 adc_ch3 = 0 adc_ch4 = 1722 adc_ch5 = 0 adc_ch6 = 1725 adc_ch7 = 0 Change-Id: I72efd09c9f7dbff25c4f6fd4846c9b1c1e5637ca Reviewed-on: https://chromium-review.googlesource.com/228092 Reviewed-by: Vincent Palatin <vpalatin@chromium.org> Commit-Queue: Dino Li <dino.li@ite.com.tw> Tested-by: Dino Li <dino.li@ite.com.tw>
Diffstat (limited to 'chip/it83xx/adc_chip.h')
-rw-r--r--chip/it83xx/adc_chip.h34
1 files changed, 34 insertions, 0 deletions
diff --git a/chip/it83xx/adc_chip.h b/chip/it83xx/adc_chip.h
new file mode 100644
index 0000000000..ae7ee403b0
--- /dev/null
+++ b/chip/it83xx/adc_chip.h
@@ -0,0 +1,34 @@
+/* Copyright (c) 2014 The Chromium OS Authors. All rights reserved.
+ * Use of this source code is governed by a BSD-style license that can be
+ * found in the LICENSE file.
+ */
+
+/* IT8380 ADC module for Chrome EC */
+
+#ifndef __CROS_EC_ADC_CHIP_H
+#define __CROS_EC_ADC_CHIP_H
+
+/* Data structure to define ADC channel control registers. */
+struct adc_ctrl_t {
+ volatile uint8_t *adc_ctrl;
+ volatile uint8_t *adc_datm;
+ volatile uint8_t *adc_datl;
+ volatile uint8_t *adc_pin_ctrl;
+};
+
+/* Data structure to define ADC channels. */
+struct adc_t {
+ const char *name;
+ int factor_mul;
+ int factor_div;
+ int shift;
+ int channel;
+};
+
+/*
+ * Boards must provide this list of ADC channel definitions. This must match
+ * the enum adc_channel list provided by the board.
+ */
+extern const struct adc_t adc_channels[];
+
+#endif /* __CROS_EC_ADC_CHIP_H */