devicetree.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH 0/2] iio: temperature: mlx90635 Driver for MLX90635 IR temperature sensor
@ 2023-11-22 10:20 Crt Mori
  2023-11-22 10:27 ` [PATCH 2/2] dt-bindings: iio: temperature: add MLX90635 device bindings Crt Mori
  0 siblings, 1 reply; 6+ messages in thread
From: Crt Mori @ 2023-11-22 10:20 UTC (permalink / raw)
  To: Jonathan Cameron, Rob Herring
  Cc: linux-iio, linux-kernel, devicetree, Crt Mori

Hi everybody,

There is a new contactless sensor in Melexis portfolio. MLX90635 is just
1.8x1.8mm in size, but with factory calibration offers instant usage
in every project. It offers wide refresh rate range that is configurable
between 100ms and 4s.

Driver currently provides temperature calculations, power management and
changes to the refresh rate. Since sensor is aimed towards the consumer
market there is really low number of EEPROM write cycles available, so
driver changes refresh rate only in run time registers to avoid writing
to EEPROM. Reading EEPROM is not available in Sleep Step mode, so I am
using caching at the driver initialization to ensure that measurements
can still be taken in Sleep Step mode.

Crt Mori (2):
  iio: temperature: mlx90635 MLX90635 IR Temperature sensor
  dt-bindings: iio: temperature: add MLX90635 device bindings

 .../iio/temperature/melexis,mlx90635.yaml     |   60 +
 MAINTAINERS                                   |    7 +
 drivers/iio/temperature/Kconfig               |   12 +
 drivers/iio/temperature/Makefile              |    1 +
 drivers/iio/temperature/mlx90635.c            | 1099 +++++++++++++++++
 5 files changed, 1179 insertions(+)
 create mode 100644 Documentation/devicetree/bindings/iio/temperature/melexis,mlx90635.yaml
 create mode 100644 drivers/iio/temperature/mlx90635.c

-- 
2.40.1


^ permalink raw reply	[flat|nested] 6+ messages in thread

* [PATCH 2/2] dt-bindings: iio: temperature: add MLX90635 device bindings
  2023-11-22 10:20 [PATCH 0/2] iio: temperature: mlx90635 Driver for MLX90635 IR temperature sensor Crt Mori
@ 2023-11-22 10:27 ` Crt Mori
  2023-11-22 11:52   ` Krzysztof Kozlowski
  0 siblings, 1 reply; 6+ messages in thread
From: Crt Mori @ 2023-11-22 10:27 UTC (permalink / raw)
  To: Jonathan Cameron, Rob Herring
  Cc: linux-iio, linux-kernel, devicetree, Crt Mori

Add device tree bindings for MLX90635 Infra Red contactless temperature
sensor.

Signed-off-by: Crt Mori <cmo@melexis.com>
---
 .../iio/temperature/melexis,mlx90635.yaml     | 60 +++++++++++++++++++
 1 file changed, 60 insertions(+)
 create mode 100644 Documentation/devicetree/bindings/iio/temperature/melexis,mlx90635.yaml

diff --git a/Documentation/devicetree/bindings/iio/temperature/melexis,mlx90635.yaml b/Documentation/devicetree/bindings/iio/temperature/melexis,mlx90635.yaml
new file mode 100644
index 000000000000..96463121a806
--- /dev/null
+++ b/Documentation/devicetree/bindings/iio/temperature/melexis,mlx90635.yaml
@@ -0,0 +1,60 @@
+# SPDX-License-Identifier: (GPL-2.0 OR BSD-2-Clause)
+%YAML 1.2
+---
+$id: http://devicetree.org/schemas/iio/temperature/melexis,mlx90635.yaml#
+$schema: http://devicetree.org/meta-schemas/core.yaml#
+
+title: Melexis MLX90635 contactless Infra Red temperature sensor
+
+maintainers:
+  - Crt Mori <cmo@melexis.com>
+
+description: |
+  https://www.melexis.com/en/documents/documentation/datasheets/datasheet-mlx90635
+
+  There are various applications for the Infra Red contactless temperature
+  sensor and MLX90635 is most suitable for consumer applications where
+  measured object temperature is in range between -20 to 100 degrees
+  Celsius with relative error of measurement 2 degree Celsius in
+  object temperature range for industrial applications, while just 0.2
+  degree Celsius for human body measurement applications. Since it can
+  operate and measure ambient temperature in range of -20 to 85 degrees
+  Celsius it is suitable also for outdoor use.
+
+  Be aware that electronics surrounding the sensor can increase ambient
+  temperature. MLX90635 can be calibrated to reduce the housing effect via
+  already existing EEPROM parameters.
+
+  Since measured object emissivity effects Infra Red energy emitted,
+  emissivity should be set before requesting the object temperature.
+
+properties:
+  compatible:
+    const: melexis,mlx90635
+
+  reg:
+    maxItems: 1
+    description: Default is 0x3a, but can be reprogrammed.
+
+  vdd-supply:
+    description: provide VDD power to the sensor (check datasheet for voltage).
+
+required:
+  - compatible
+  - reg
+
+additionalProperties: false
+
+examples:
+  - |
+    i2c {
+        #address-cells = <1>;
+        #size-cells = <0>;
+
+        temp-sensor@3a {
+            compatible = "melexis,mlx90635";
+            reg = <0x3a>;
+            vdd-supply = <&ldo4_reg>;
+        };
+    };
+...
-- 
2.40.1


^ permalink raw reply related	[flat|nested] 6+ messages in thread

* Re: [PATCH 2/2] dt-bindings: iio: temperature: add MLX90635 device bindings
  2023-11-22 10:27 ` [PATCH 2/2] dt-bindings: iio: temperature: add MLX90635 device bindings Crt Mori
@ 2023-11-22 11:52   ` Krzysztof Kozlowski
  2023-11-22 12:28     ` Crt Mori
  0 siblings, 1 reply; 6+ messages in thread
From: Krzysztof Kozlowski @ 2023-11-22 11:52 UTC (permalink / raw)
  To: Crt Mori, Jonathan Cameron, Rob Herring
  Cc: linux-iio, linux-kernel, devicetree

On 22/11/2023 11:27, Crt Mori wrote:
> Add device tree bindings for MLX90635 Infra Red contactless temperature
> sensor.

Please use scripts/get_maintainers.pl to get a list of necessary people
and lists to CC (and consider --no-git-fallback argument). It might
happen, that command when run on an older kernel, gives you outdated
entries. Therefore please be sure you base your patches on recent Linux
kernel.

A nit, subject: drop second/last, redundant "bindings". The
"dt-bindings" prefix is already stating that these are bindings.

> 
> Signed-off-by: Crt Mori <cmo@melexis.com>
> ---
>  .../iio/temperature/melexis,mlx90635.yaml     | 60 +++++++++++++++++++
>  1 file changed, 60 insertions(+)
>  create mode 100644 Documentation/devicetree/bindings/iio/temperature/melexis,mlx90635.yaml
> 
> diff --git a/Documentation/devicetree/bindings/iio/temperature/melexis,mlx90635.yaml b/Documentation/devicetree/bindings/iio/temperature/melexis,mlx90635.yaml
> new file mode 100644
> index 000000000000..96463121a806
> --- /dev/null
> +++ b/Documentation/devicetree/bindings/iio/temperature/melexis,mlx90635.yaml
> @@ -0,0 +1,60 @@
> +# SPDX-License-Identifier: (GPL-2.0 OR BSD-2-Clause)
> +%YAML 1.2
> +---
> +$id: http://devicetree.org/schemas/iio/temperature/melexis,mlx90635.yaml#
> +$schema: http://devicetree.org/meta-schemas/core.yaml#
> +
> +title: Melexis MLX90635 contactless Infra Red temperature sensor
> +
> +maintainers:
> +  - Crt Mori <cmo@melexis.com>
> +
> +description: |
> +  https://www.melexis.com/en/documents/documentation/datasheets/datasheet-mlx90635
> +
> +  There are various applications for the Infra Red contactless temperature
> +  sensor and MLX90635 is most suitable for consumer applications where
> +  measured object temperature is in range between -20 to 100 degrees
> +  Celsius with relative error of measurement 2 degree Celsius in
> +  object temperature range for industrial applications, while just 0.2
> +  degree Celsius for human body measurement applications. Since it can
> +  operate and measure ambient temperature in range of -20 to 85 degrees
> +  Celsius it is suitable also for outdoor use.
> +
> +  Be aware that electronics surrounding the sensor can increase ambient
> +  temperature. MLX90635 can be calibrated to reduce the housing effect via
> +  already existing EEPROM parameters.
> +
> +  Since measured object emissivity effects Infra Red energy emitted,
> +  emissivity should be set before requesting the object temperature.
> +
> +properties:
> +  compatible:
> +    const: melexis,mlx90635

It's the same as mlx90632. Add it there (as enum).

Best regards,
Krzysztof


^ permalink raw reply	[flat|nested] 6+ messages in thread

* Re: [PATCH 2/2] dt-bindings: iio: temperature: add MLX90635 device bindings
  2023-11-22 11:52   ` Krzysztof Kozlowski
@ 2023-11-22 12:28     ` Crt Mori
  2023-11-22 12:35       ` Krzysztof Kozlowski
  0 siblings, 1 reply; 6+ messages in thread
From: Crt Mori @ 2023-11-22 12:28 UTC (permalink / raw)
  To: Krzysztof Kozlowski
  Cc: Jonathan Cameron, Rob Herring, linux-iio, linux-kernel,
	devicetree

On Wed, 22 Nov 2023 at 12:52, Krzysztof Kozlowski <krzk@kernel.org> wrote:
>
> On 22/11/2023 11:27, Crt Mori wrote:
> > Add device tree bindings for MLX90635 Infra Red contactless temperature
> > sensor.
>
> Please use scripts/get_maintainers.pl to get a list of necessary people
> and lists to CC (and consider --no-git-fallback argument). It might
> happen, that command when run on an older kernel, gives you outdated
> entries. Therefore please be sure you base your patches on recent Linux
> kernel.
>

OK, will put everyone in that list in next spin.

> A nit, subject: drop second/last, redundant "bindings". The
> "dt-bindings" prefix is already stating that these are bindings.
>

 Ok, will fix that in next version (probably main driver review will
get some comments).

> >
> > Signed-off-by: Crt Mori <cmo@melexis.com>
> > ---
> >  .../iio/temperature/melexis,mlx90635.yaml     | 60 +++++++++++++++++++
> >  1 file changed, 60 insertions(+)
> >  create mode 100644 Documentation/devicetree/bindings/iio/temperature/melexis,mlx90635.yaml
> >
> > diff --git a/Documentation/devicetree/bindings/iio/temperature/melexis,mlx90635.yaml b/Documentation/devicetree/bindings/iio/temperature/melexis,mlx90635.yaml
> > new file mode 100644
> > index 000000000000..96463121a806
> > --- /dev/null
> > +++ b/Documentation/devicetree/bindings/iio/temperature/melexis,mlx90635.yaml
> > @@ -0,0 +1,60 @@
> > +# SPDX-License-Identifier: (GPL-2.0 OR BSD-2-Clause)
> > +%YAML 1.2
> > +---
> > +$id: http://devicetree.org/schemas/iio/temperature/melexis,mlx90635.yaml#
> > +$schema: http://devicetree.org/meta-schemas/core.yaml#
> > +
> > +title: Melexis MLX90635 contactless Infra Red temperature sensor
> > +
> > +maintainers:
> > +  - Crt Mori <cmo@melexis.com>
> > +
> > +description: |
> > +  https://www.melexis.com/en/documents/documentation/datasheets/datasheet-mlx90635
> > +
> > +  There are various applications for the Infra Red contactless temperature
> > +  sensor and MLX90635 is most suitable for consumer applications where
> > +  measured object temperature is in range between -20 to 100 degrees
> > +  Celsius with relative error of measurement 2 degree Celsius in
> > +  object temperature range for industrial applications, while just 0.2
> > +  degree Celsius for human body measurement applications. Since it can
> > +  operate and measure ambient temperature in range of -20 to 85 degrees
> > +  Celsius it is suitable also for outdoor use.
> > +
> > +  Be aware that electronics surrounding the sensor can increase ambient
> > +  temperature. MLX90635 can be calibrated to reduce the housing effect via
> > +  already existing EEPROM parameters.
> > +
> > +  Since measured object emissivity effects Infra Red energy emitted,
> > +  emissivity should be set before requesting the object temperature.
> > +
> > +properties:
> > +  compatible:
> > +    const: melexis,mlx90635
>
> It's the same as mlx90632. Add it there (as enum).
>

Properties are the same, but then you can't have much differences for
a temperature sensor. It has a bit worse relative measurement error
outside of the human body range and overall different DSP, register
map, even physical size - it's 1.8x1.8 mm compared to 90632 3x3 mm. I
was not sure how it qualifies for adding it as another enum, but I
went with the feeling that if it can reuse the driver, then it is an
enum, otherwise it is a new file. And I could not reuse anything from
90632.

Thanks for quick feedback and best regards,
Crt
> Best regards,
> Krzysztof
>

^ permalink raw reply	[flat|nested] 6+ messages in thread

* Re: [PATCH 2/2] dt-bindings: iio: temperature: add MLX90635 device bindings
  2023-11-22 12:28     ` Crt Mori
@ 2023-11-22 12:35       ` Krzysztof Kozlowski
  2023-11-25 17:27         ` Jonathan Cameron
  0 siblings, 1 reply; 6+ messages in thread
From: Krzysztof Kozlowski @ 2023-11-22 12:35 UTC (permalink / raw)
  To: Crt Mori; +Cc: Jonathan Cameron, Rob Herring, linux-iio, linux-kernel,
	devicetree

On 22/11/2023 13:28, Crt Mori wrote:
>>> +  Since measured object emissivity effects Infra Red energy emitted,
>>> +  emissivity should be set before requesting the object temperature.
>>> +
>>> +properties:
>>> +  compatible:
>>> +    const: melexis,mlx90635
>>
>> It's the same as mlx90632. Add it there (as enum).
>>
> 
> Properties are the same, but then you can't have much differences for
> a temperature sensor. It has a bit worse relative measurement error
> outside of the human body range and overall different DSP, register
> map, even physical size - it's 1.8x1.8 mm compared to 90632 3x3 mm. I
> was not sure how it qualifies for adding it as another enum, but I
> went with the feeling that if it can reuse the driver, then it is an
> enum, otherwise it is a new file. And I could not reuse anything from
> 90632.
> 
> Thanks for quick feedback and best regards,

Driver is independent choice. There is no need for new binding file if
everything is the same from bindings point of view.

Best regards,
Krzysztof


^ permalink raw reply	[flat|nested] 6+ messages in thread

* Re: [PATCH 2/2] dt-bindings: iio: temperature: add MLX90635 device bindings
  2023-11-22 12:35       ` Krzysztof Kozlowski
@ 2023-11-25 17:27         ` Jonathan Cameron
  0 siblings, 0 replies; 6+ messages in thread
From: Jonathan Cameron @ 2023-11-25 17:27 UTC (permalink / raw)
  To: Krzysztof Kozlowski
  Cc: Crt Mori, Rob Herring, linux-iio, linux-kernel, devicetree

On Wed, 22 Nov 2023 13:35:19 +0100
Krzysztof Kozlowski <krzk@kernel.org> wrote:

> On 22/11/2023 13:28, Crt Mori wrote:
> >>> +  Since measured object emissivity effects Infra Red energy emitted,
> >>> +  emissivity should be set before requesting the object temperature.
> >>> +
> >>> +properties:
> >>> +  compatible:
> >>> +    const: melexis,mlx90635  
> >>
> >> It's the same as mlx90632. Add it there (as enum).
> >>  
> > 
> > Properties are the same, but then you can't have much differences for
> > a temperature sensor. It has a bit worse relative measurement error
> > outside of the human body range and overall different DSP, register
> > map, even physical size - it's 1.8x1.8 mm compared to 90632 3x3 mm. I
> > was not sure how it qualifies for adding it as another enum, but I
> > went with the feeling that if it can reuse the driver, then it is an
> > enum, otherwise it is a new file. And I could not reuse anything from
> > 90632.
> > 
> > Thanks for quick feedback and best regards,  
> 
> Driver is independent choice. There is no need for new binding file if
> everything is the same from bindings point of view.
> 
> Best regards,
> Krzysztof
> 
> 

We got this wrong in the past in IIO and it's a slow effort to merge
the various very similar bindings.  For now we are mostly keeping
to within a vendor though unless a driver supports parts from multiple
vendors.  It potentially gets too confusing to maintain otherwise.

This one is easy case though so definitely merge as Krzystof suggested!

Jonathan

^ permalink raw reply	[flat|nested] 6+ messages in thread

end of thread, other threads:[~2023-11-25 17:28 UTC | newest]

Thread overview: 6+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2023-11-22 10:20 [PATCH 0/2] iio: temperature: mlx90635 Driver for MLX90635 IR temperature sensor Crt Mori
2023-11-22 10:27 ` [PATCH 2/2] dt-bindings: iio: temperature: add MLX90635 device bindings Crt Mori
2023-11-22 11:52   ` Krzysztof Kozlowski
2023-11-22 12:28     ` Crt Mori
2023-11-22 12:35       ` Krzysztof Kozlowski
2023-11-25 17:27         ` Jonathan Cameron

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).