summaryrefslogtreecommitdiff
path: root/zephyr/shim/src/adc.c
diff options
context:
space:
mode:
Diffstat (limited to 'zephyr/shim/src/adc.c')
-rw-r--r--zephyr/shim/src/adc.c11
1 files changed, 6 insertions, 5 deletions
diff --git a/zephyr/shim/src/adc.c b/zephyr/shim/src/adc.c
index 4f66774466..4b2de4bd24 100644
--- a/zephyr/shim/src/adc.c
+++ b/zephyr/shim/src/adc.c
@@ -10,8 +10,11 @@
LOG_MODULE_REGISTER(shim_adc, LOG_LEVEL_ERR);
-#define ADC_NODE DT_NODELABEL(adc0)
-const struct device *adc_dev;
+#if defined(CONFIG_PLATFORM_EC_ADC_CMD) && defined(CONFIG_ADC_SHELL)
+#error "Define only one 'adc' console command."
+#endif
+
+#define adc_dev DEVICE_DT_GET(DT_CHOSEN(cros_ec_adc))
#define HAS_NAMED_ADC_CHANNELS DT_NODE_EXISTS(DT_INST(0, named_adc_channels))
@@ -43,11 +46,9 @@ const struct adc_t adc_channels[] = { DT_FOREACH_CHILD(
static int init_device_bindings(const struct device *device)
{
ARG_UNUSED(device);
- adc_dev = DEVICE_DT_GET(ADC_NODE);
if (!device_is_ready(adc_dev)) {
- LOG_ERR("Error: device %s is not ready", adc_dev->name);
- return -1;
+ k_oops();
}
#if HAS_NAMED_ADC_CHANNELS