Skip to contentSkip to conversation

dt-bindings: iio: chemical: Add sharp,gp2y1010au0f

PATCH In review [email protected] 2 participants 3 messages Apr 25, 2025 – Apr 26, 2025

Subsystems (2)
lore
Share & tools
lore
#0 lore raw

PATCH 1/2 dt-bindings: iio: chemical: Add sharp,gp2y1010au0f

From: Suraj Sonawane <[email protected]>

Add Device Tree bindings for Sharp GP2Y1010AU0F optical dust sensor. The sensor measures particulate matter concentration via infrared scattering and requires:

1. GPIO for LED pulse control (280μs pulses with 40μs delay)
2. ADC channel for analog output measurement
3. Power regulator (vdd-supply)

Datasheet:
https://global.sharp/products/device/lineup/data/pdf/datasheet/gp2y1010au_appl_e.pdf

---
 .../iio/chemical/sharp,gp2y1010au0f.yaml      | 67 +++++++++++++++++++
 1 file changed, 67 insertions(+)
 create mode 100644 Documentation/devicetree/bindings/iio/chemical/sharp,gp2y1010au0f.yaml
Documentation/devicetree/bindings/iio/chemical/sharp,gp2y1010au0f.yaml new file +67 -0
new file mode 100644
index 000000000..358c2b2f7
@@ -0,0 +1,67 @@
+# SPDX-License-Identifier: (GPL-2.0 OR BSD-2-Clause)
+%YAML 1.2
+---
+$id: http://devicetree.org/schemas/iio/chemical/sharp,gp2y1010au0f.yaml#
+$schema: http://devicetree.org/meta-schemas/core.yaml#
+
+title: Sharp GP2Y1010AU0F Optical Dust Sensor
+
+maintainers:
+  - Suraj Sonawane <[email protected]>
+
+description: |
+  Optical dust sensor measuring particulate matter concentration via infrared scattering.
+  Requires ADC for analog output and GPIO for pulsed LED control with strict timing.
+  Datasheet: https://global.sharp/products/device/lineup/data/pdf/datasheet/gp2y1010au_appl_e.pdf
+
+properties:
+  compatible:
+    const: sharp,gp2y1010au0f
+
+  vdd-supply:
+    description: Phandle to the regulator that provides power to the sensor
+
+  led-gpios:
+    description: GPIO connected to the sensor's LED control pin (V-LED)
+    maxItems: 1
+
+  io-channels:
+    description: ADC channel connected to the sensor's analog output (Vo)
+    maxItems: 1
+
+  io-channel-names:
+    const: dust
+
+  sharp,led-on-delay-us:
+    description: Time in microseconds to wait after turning LED on before ADC read
+    default: 40
+    minimum: 0
+    maximum: 100
+
+  sharp,measurement-window-us:
+    description: Measurement window in microseconds after LED turn-on
+    default: 200
+    minimum: 0
+    maximum: 280
+
+required:
+  - compatible
+  - led-gpios
+  - io-channels
+  - io-channel-names
+
+additionalProperties: false
+
+examples:
+  - |
+    #include <dt-bindings/gpio/gpio.h>
+
+    dust_sensor {
+        compatible = "sharp,gp2y1010au0f";
+        vdd-supply = <&vcc>;
+        led-gpios = <&gpio 44 GPIO_ACTIVE_HIGH>;
+        io-channels = <&adc 0>;
+        io-channel-names = "dust";
+        sharp,led-on-delay-us = <40>;
+        sharp,measurement-window-us = <200>;
+    };
Signature · 1 line
2.34.1
maintainer
#1 lore raw
Quoted 1 line · On Sat, 26 Apr 2025 03:21:49 +0530 [email protected] wrote:

From: Suraj Sonawane <[email protected]>

Hi Suraj,

Welcome to IIO.

Quoted 11 lines

Add Device Tree bindings for Sharp GP2Y1010AU0F optical dust sensor. The sensor measures particulate matter concentration via infrared scattering and requires:

1. GPIO for LED pulse control (280μs pulses with 40μs delay)
2. ADC channel for analog output measurement
3. Power regulator (vdd-supply)

Datasheet:
https://global.sharp/products/device/lineup/data/pdf/datasheet/gp2y1010au_appl_e.pdf

This can be a tag, so put it all on one line and drop this blank line so it forms part of the tag block. Don't worry about checkpatch warning that will result. It never got updated for Datasheet: properly.

Quoted 25 lines
---
 .../iio/chemical/sharp,gp2y1010au0f.yaml      | 67 +++++++++++++++++++
 1 file changed, 67 insertions(+)
 create mode 100644 Documentation/devicetree/bindings/iio/chemical/sharp,gp2y1010au0f.yaml
Documentation/devicetree/bindings/iio/chemical/sharp,gp2y1010au0f.yaml new file +12 -0
new file mode 100644
index 000000000..358c2b2f7
@@ -0,0 +1,67 @@
+# SPDX-License-Identifier: (GPL-2.0 OR BSD-2-Clause)
+%YAML 1.2
+---
+$id: http://devicetree.org/schemas/iio/chemical/sharp,gp2y1010au0f.yaml#
+$schema: http://devicetree.org/meta-schemas/core.yaml#
+
+title: Sharp GP2Y1010AU0F Optical Dust Sensor
+
+maintainers:
+  - Suraj Sonawane <[email protected]>
+
+description: |

Documentation/devicetree/bindings/iio/chemical/sharp,gp2y1010au0f.yaml line 22

Quoted 10 lines
Documentation/devicetree/bindings/iio/chemical/sharp,gp2y1010au0f.yaml new file +10 -0
+  Optical dust sensor measuring particulate matter concentration via infrared scattering.
+  Requires ADC for analog output and GPIO for pulsed LED control with strict timing.
+  Datasheet: https://global.sharp/products/device/lineup/data/pdf/datasheet/gp2y1010au_appl_e.pdf
+
+properties:
+  compatible:
+    const: sharp,gp2y1010au0f
+
+  vdd-supply:
+    description: Phandle to the regulator that provides power to the sensor

For a simple supply voltage no real need for the docs.
vdd-supply: true
is usually enough.

Quoted 4 lines
Documentation/devicetree/bindings/iio/chemical/sharp,gp2y1010au0f.yaml new file +4 -0
+
+  led-gpios:
+    description: GPIO connected to the sensor's LED control pin (V-LED)
+    maxItems: 1

Documentation/devicetree/bindings/iio/chemical/sharp,gp2y1010au0f.yaml line 36

Quoted 10 lines
Documentation/devicetree/bindings/iio/chemical/sharp,gp2y1010au0f.yaml new file +10 -0
+
+  io-channels:
+    description: ADC channel connected to the sensor's analog output (Vo)
+    maxItems: 1
+
+  io-channel-names:
+    const: dust
+
+  sharp,led-on-delay-us:
+    description: Time in microseconds to wait after turning LED on before ADC read

The datasheet seems to suggest a 0.28msec value for this for an LED pulse width of 0.32msecs

Hence maybe you could give a spec reference for the range given here? I may well be looking at the wrong bit of the datasheet!

Documentation/devicetree/bindings/iio/chemical/sharp,gp2y1010au0f.yaml line 42

Quoted 6 lines
Documentation/devicetree/bindings/iio/chemical/sharp,gp2y1010au0f.yaml new file +6 -0
+    default: 40
+    minimum: 0
+    maximum: 100
+
+  sharp,measurement-window-us:
+    description: Measurement window in microseconds after LED turn-on

I'm not able to directly relate this to what I'm seeing on the datasheet. Is this just the on time?

Quoted 7 lines
Documentation/devicetree/bindings/iio/chemical/sharp,gp2y1010au0f.yaml new file +7 -0
+    default: 200
+    minimum: 0
+    maximum: 280
+
+required:
+  - compatible
+  - led-gpios

Documentation/devicetree/bindings/iio/chemical/sharp,gp2y1010au0f.yaml line 59

Quoted 10 lines
Documentation/devicetree/bindings/iio/chemical/sharp,gp2y1010au0f.yaml new file +10 -0
+  - io-channels
+  - io-channel-names
+
+additionalProperties: false
+
+examples:
+  - |
+    #include <dt-bindings/gpio/gpio.h>
+
+    dust_sensor {

I think this needs a reg, even if that is just an index so we can keep track of multiple sensors.

Quoted 8 lines
Documentation/devicetree/bindings/iio/chemical/sharp,gp2y1010au0f.yaml new file +8 -0
+        compatible = "sharp,gp2y1010au0f";
+        vdd-supply = <&vcc>;
+        led-gpios = <&gpio 44 GPIO_ACTIVE_HIGH>;
+        io-channels = <&adc 0>;
+        io-channel-names = "dust";
+        sharp,led-on-delay-us = <40>;
+        sharp,measurement-window-us = <200>;	
+    };
maintainer
#2 lore raw
In reply to [email protected]
Quoted 6 lines · On Sat, 26 Apr 2025 03:21:49 +0530 [email protected] wrote:

From: Suraj Sonawane <[email protected]>

Add Device Tree bindings for Sharp GP2Y1010AU0F optical dust sensor. The sensor measures particulate matter concentration via infrared scattering and requires:

Quoted 8 lines

1. GPIO for LED pulse control (280μs pulses with 40μs delay)
2. ADC channel for analog output measurement
3. Power regulator (vdd-supply)

Datasheet:
https://global.sharp/products/device/lineup/data/pdf/datasheet/gp2y1010au_appl_e.pdf

Hi. Quick process thing.

Even for a small series, please use a cover letter to provide:
- a short intro to the patch set
- A nice name for patchwork and threading email clients!
- Somewhere for people to give patch set wide comments / review tags.

With git that just means passing --cover-letter to git format-patch
+ filling in the resulting file.

Jonathan