Linux IIO development
 help / color / mirror / Atom feed
From: David Lechner <dlechner@baylibre.com>
To: surajsonawane0215@gmail.com, Jonathan Cameron <jic23@kernel.org>
Cc: "Nuno Sá" <nuno.sa@analog.com>,
	"Andy Shevchenko" <andy@kernel.org>,
	"Rob Herring" <robh@kernel.org>,
	"Krzysztof Kozlowski" <krzk+dt@kernel.org>,
	"Conor Dooley" <conor+dt@kernel.org>,
	linux-iio@vger.kernel.org, devicetree@vger.kernel.org,
	linux-kernel@vger.kernel.org
Subject: Re: [PATCH v2 2/3] dt-bindings: iio: chemical: Add sharp,gp2y1010au0f
Date: Thu, 12 Jun 2025 11:37:07 -0500	[thread overview]
Message-ID: <654c6750-9359-4d66-934a-e936c0b86009@baylibre.com> (raw)
In-Reply-To: <20250612100758.13241-3-surajsonawane0215@gmail.com>

On 6/12/25 5:07 AM, surajsonawane0215@gmail.com wrote:
> From: Suraj Sonawane <surajsonawane0215@gmail.com>
> 
> Add device tree bindings for Sharp GP2Y1010AU0F optical dust sensor.
> The sensor measures particulate matter concentration via infrared
> scattering with pulsed LED illumination and analog output.
> 
> Datasheet: https://global.sharp/products/device/lineup/data/pdf/datasheet/gp2y1010au_appl_e.pdf
> 
> Signed-off-by: Suraj Sonawane <surajsonawane0215@gmail.com>
> ---
> V1: https://lore.kernel.org/lkml/20250425215149.49068-1-surajsonawane0215@gmail.com/ 
> V2: 
> - Updated timing properties to match datasheet exactly
> - Added reg property for multi-sensor support
> 
>  .../iio/chemical/sharp,gp2y1010au0f.yaml      | 78 +++++++++++++++++++
>  1 file changed, 78 insertions(+)
>  create mode 100644 Documentation/devicetree/bindings/iio/chemical/sharp,gp2y1010au0f.yaml
> 
> diff --git a/Documentation/devicetree/bindings/iio/chemical/sharp,gp2y1010au0f.yaml b/Documentation/devicetree/bindings/iio/chemical/sharp,gp2y1010au0f.yaml
> new file mode 100644
> index 000000000..b4e5110d0
> --- /dev/null
> +++ b/Documentation/devicetree/bindings/iio/chemical/sharp,gp2y1010au0f.yaml
> @@ -0,0 +1,78 @@
> +# 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 <surajsonawane0215@gmail.com>
> +
> +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
> +
> +  reg:
> +    maxItems: 1

There is no SPI or I2C bus, so reg doesn't make sense.

> +
> +  vdd-supply: true
> +
> +  led-gpios:
> +    description: GPIO connected to the sensor's LED control pin (V-LED)
> +    maxItems: 1

From the looks of the datasheet it seems like the light requires
a PWM rather than a GPIO to control it. I don't see how a GPIO
could be accurate enough in the timing.

> +
> +  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: |
> +      Delay in microseconds after turning the LED ON before reading ADC.
> +      The datasheet recommends 280µs after LED ON for accurate measurement.
> +      (See Section 6-1 of the datasheet: Sampling timing = 0.28ms)
> +
> +    default: 280
> +    minimum: 0
> +    maximum: 320

For this, I would expect the same or a synchronized PWM output to trigger
the ADC in order to be able to get accurate enough timing.

> +
> +  sharp,measurement-window-us:
> +    description: |
> +      Duration in microseconds the LED remains ON for measurement.
> +      The recommended pulse width is 320µs ±20µs. (See Section 6-1)
> +
> +    default: 320
> +    minimum: 300
> +    maximum: 340

And this would be the duty cycle of the light PWM.


> +
> +required:
> +  - compatible
> +  - reg
> +  - led-gpios
> +  - io-channels
> +  - io-channel-names
> +
> +additionalProperties: false
> +
> +examples:
> +  - |
> +    #include <dt-bindings/gpio/gpio.h>
> +
> +    dust_sensor {
> +        compatible = "sharp,gp2y1010au0f";
> +        reg = <0>;
> +        vdd-supply = <&vcc>;
> +        led-gpios = <&gpio 44 GPIO_ACTIVE_HIGH>;
> +        io-channels = <&adc 0>;
> +        io-channel-names = "dust";
> +        sharp,led-on-delay-us = <280>;
> +        sharp,measurement-window-us = <320>;
> +    };


  parent reply	other threads:[~2025-06-12 16:37 UTC|newest]

Thread overview: 11+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2025-06-12 10:07 [PATCH v2 0/3] iio: chemical: Add Sharp GP2Y1010AU0F dust sensor support surajsonawane0215
2025-06-12 10:07 ` [PATCH v2 1/3] iio: Add IIO_DENSITY channel type surajsonawane0215
2025-06-12 12:58   ` Andy Shevchenko
2025-06-12 16:23   ` David Lechner
2025-06-12 10:07 ` [PATCH v2 2/3] dt-bindings: iio: chemical: Add sharp,gp2y1010au0f surajsonawane0215
2025-06-12 10:23   ` Krzysztof Kozlowski
2025-06-12 16:37   ` David Lechner [this message]
2025-06-12 10:07 ` [PATCH v2 3/3] iio: chemical: Add driver for Sharp GP2Y1010AU0F surajsonawane0215
2025-06-12 13:15   ` Andy Shevchenko
2025-06-12 18:24   ` David Lechner
2025-06-14 12:33   ` Jonathan Cameron

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=654c6750-9359-4d66-934a-e936c0b86009@baylibre.com \
    --to=dlechner@baylibre.com \
    --cc=andy@kernel.org \
    --cc=conor+dt@kernel.org \
    --cc=devicetree@vger.kernel.org \
    --cc=jic23@kernel.org \
    --cc=krzk+dt@kernel.org \
    --cc=linux-iio@vger.kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=nuno.sa@analog.com \
    --cc=robh@kernel.org \
    --cc=surajsonawane0215@gmail.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox