Skip to content

Instantly share code, notes, and snippets.

@jimparis
Created August 6, 2019 15:11
Show Gist options
  • Save jimparis/0b1e0436556b4cfcc6154a49ce48bbc6 to your computer and use it in GitHub Desktop.
Save jimparis/0b1e0436556b4cfcc6154a49ce48bbc6 to your computer and use it in GitHub Desktop.
commit 2cce0bf617358deb2450fee87ab01a8cef7274ea
Author: Jim Paris <jim@jtan.com>
Date: Mon May 6 23:07:13 2019 -0400
Support referencing a specific ADC input in DT properties
This lets us do e.g.:
foo {
compatible = "bar";
input-adcs = <&adc 4>;
};
and get DT properties like:
DT_BAR_FOO_INPUT_ADCS_CONTROLLER="ADC_0"
DT_BAR_FOO_INPUT_ADCS_INPUT=4
similar to existing -gpios and -pwms support.
Signed-off-by: Jim Paris <jim@jtan.com>
diff --git a/dts/bindings/iio/adc/adc.yaml b/dts/bindings/iio/adc/adc.yaml
index e387b0836f41..1f31aeebbf52 100644
--- a/dts/bindings/iio/adc/adc.yaml
+++ b/dts/bindings/iio/adc/adc.yaml
@@ -15,3 +15,8 @@ inherits:
properties:
label:
category: required
+
+cell_string: ADC
+
+"#cells":
+ - input
diff --git a/scripts/dts/extract_dts_includes.py b/scripts/dts/extract_dts_includes.py
index e3ceff1b2b31..8cbf87c9fbff 100755
--- a/scripts/dts/extract_dts_includes.py
+++ b/scripts/dts/extract_dts_includes.py
@@ -84,7 +84,7 @@ def generate_prop_defines(node_path, prop):
compatible.extract(node_path, prop, def_label)
elif 'clocks' in prop:
clocks.extract(node_path, prop, def_label)
- elif 'pwms' in prop or 'gpios' in prop:
+ elif 'pwms' in prop or 'gpios' in prop or 'adcs' in prop:
prop_values = reduced[node_path]['props'][prop]
generic = prop[:-1] # Drop the 's' from the prop
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment