All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH v2 0/2] iio: chemical: atlas-sensor: add RTD-SM module support
@ 2020-04-19  6:05 Matt Ranostay
  2020-04-19  6:05 ` [PATCH v2 1/2] dt-bindings: iio: chemical: add Atlas Scientific RTD-SM sensor docs Matt Ranostay
  2020-04-19  6:05 ` [PATCH v2 2/2] iio: chemical: atlas-sensor: add RTD-SM module support Matt Ranostay
  0 siblings, 2 replies; 5+ messages in thread
From: Matt Ranostay @ 2020-04-19  6:05 UTC (permalink / raw)
  To: jic23; +Cc: linux-iio, Matt Ranostay

Add support for Atlas Scientific RTD-SM module support which reports
back temperature data down to a millicelius resoluton

Changes from v1:
* fix borked patchset

Matt Ranostay (2):
  dt-bindings: iio: chemical: add Atlas Scientific RTD-SM sensor docs
  iio: chemical: atlas-sensor: add RTD-SM module support

 .../bindings/iio/chemical/atlas,sensor.yaml   |  2 ++
 drivers/iio/chemical/atlas-sensor.c           | 28 +++++++++++++++++++
 2 files changed, 30 insertions(+)

-- 
2.20.1


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

* [PATCH v2 1/2] dt-bindings: iio: chemical: add Atlas Scientific RTD-SM sensor docs
  2020-04-19  6:05 [PATCH v2 0/2] iio: chemical: atlas-sensor: add RTD-SM module support Matt Ranostay
@ 2020-04-19  6:05 ` Matt Ranostay
  2020-04-19  6:05 ` [PATCH v2 2/2] iio: chemical: atlas-sensor: add RTD-SM module support Matt Ranostay
  1 sibling, 0 replies; 5+ messages in thread
From: Matt Ranostay @ 2020-04-19  6:05 UTC (permalink / raw)
  To: jic23; +Cc: linux-iio, Matt Ranostay, devicetree

Cc: devicetree@vger.kernel.org
Signed-off-by: Matt Ranostay <matt.ranostay@konsulko.com>
---
 .../devicetree/bindings/iio/chemical/atlas,sensor.yaml          | 2 ++
 1 file changed, 2 insertions(+)

diff --git a/Documentation/devicetree/bindings/iio/chemical/atlas,sensor.yaml b/Documentation/devicetree/bindings/iio/chemical/atlas,sensor.yaml
index edcd2904d50e..0e510a52920d 100644
--- a/Documentation/devicetree/bindings/iio/chemical/atlas,sensor.yaml
+++ b/Documentation/devicetree/bindings/iio/chemical/atlas,sensor.yaml
@@ -17,6 +17,7 @@ description: |
     http://www.atlas-scientific.com/_files/_datasheets/_oem/EC_oem_datasheet.pdf
     http://www.atlas-scientific.com/_files/_datasheets/_oem/ORP_oem_datasheet.pdf
     http://www.atlas-scientific.com/_files/_datasheets/_oem/pH_oem_datasheet.pdf
+    http://www.atlas-scientific.com/_files/_datasheets/_oem/RTD_oem_datasheet.pdf
 
 properties:
   compatible:
@@ -25,6 +26,7 @@ properties:
       - atlas,ec-sm
       - atlas,orp-sm
       - atlas,ph-sm
+      - atlas,rtd-sm
 
   reg:
      maxItems: 1
-- 
2.20.1


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

* [PATCH v2 2/2] iio: chemical: atlas-sensor: add RTD-SM module support
  2020-04-19  6:05 [PATCH v2 0/2] iio: chemical: atlas-sensor: add RTD-SM module support Matt Ranostay
  2020-04-19  6:05 ` [PATCH v2 1/2] dt-bindings: iio: chemical: add Atlas Scientific RTD-SM sensor docs Matt Ranostay
@ 2020-04-19  6:05 ` Matt Ranostay
  2020-04-19  9:18   ` Peter Meerwald-Stadler
  1 sibling, 1 reply; 5+ messages in thread
From: Matt Ranostay @ 2020-04-19  6:05 UTC (permalink / raw)
  To: jic23; +Cc: linux-iio, Matt Ranostay

Atlas Scientific RTD-SM OEM sensor reads temperate using
resistance temperature detector technology.

Signed-off-by: Matt Ranostay <matt.ranostay@konsulko.com>
---
 drivers/iio/chemical/atlas-sensor.c | 28 ++++++++++++++++++++++++++++
 1 file changed, 28 insertions(+)

diff --git a/drivers/iio/chemical/atlas-sensor.c b/drivers/iio/chemical/atlas-sensor.c
index 82d470561ad3..c7ed9004cf82 100644
--- a/drivers/iio/chemical/atlas-sensor.c
+++ b/drivers/iio/chemical/atlas-sensor.c
@@ -68,16 +68,20 @@
 #define ATLAS_REG_DO_TEMP_DATA		0x12
 #define ATLAS_REG_DO_DATA		0x22
 
+#define ATLAS_REG_RTD_DATA		0x0e
+
 #define ATLAS_PH_INT_TIME_IN_MS		450
 #define ATLAS_EC_INT_TIME_IN_MS		650
 #define ATLAS_ORP_INT_TIME_IN_MS	450
 #define ATLAS_DO_INT_TIME_IN_MS		450
+#define ATLAS_RTD_INT_TIME_IN_MS	450
 
 enum {
 	ATLAS_PH_SM,
 	ATLAS_EC_SM,
 	ATLAS_ORP_SM,
 	ATLAS_DO_SM,
+	ATLAS_RTD_SM,
 };
 
 struct atlas_data {
@@ -206,6 +210,22 @@ static const struct iio_chan_spec atlas_do_channels[] = {
 	},
 };
 
+static const struct iio_chan_spec atlas_rtd_channels[] = {
+	{
+		.type = IIO_TEMP,
+		.address = ATLAS_REG_RTD_DATA,
+		.info_mask_separate = BIT(IIO_CHAN_INFO_PROCESSED),
+		.scan_index = 0,
+		.scan_type = {
+			.sign = 'u',
+			.realbits = 32,
+			.storagebits = 32,
+			.endianness = IIO_BE,
+		},
+	},
+	IIO_CHAN_SOFT_TIMESTAMP(1),
+};
+
 static int atlas_check_ph_calibration(struct atlas_data *data)
 {
 	struct device *dev = &data->client->dev;
@@ -350,6 +370,12 @@ static struct atlas_device atlas_devices[] = {
 				.calibration = &atlas_check_do_calibration,
 				.delay = ATLAS_DO_INT_TIME_IN_MS,
 	},
+	[ATLAS_RTD_SM] = {
+				.channels = atlas_rtd_channels,
+				.num_channels = 2,
+				.data_reg = ATLAS_REG_RTD_DATA,
+				.delay = ATLAS_RTD_INT_TIME_IN_MS,
+	},
 };
 
 static int atlas_set_powermode(struct atlas_data *data, int on)
@@ -566,6 +592,7 @@ static const struct i2c_device_id atlas_id[] = {
 	{ "atlas-ec-sm", ATLAS_EC_SM},
 	{ "atlas-orp-sm", ATLAS_ORP_SM},
 	{ "atlas-do-sm", ATLAS_DO_SM},
+	{ "atlas-rtd-sm", ATLAS_RTD_SM},
 	{}
 };
 MODULE_DEVICE_TABLE(i2c, atlas_id);
@@ -575,6 +602,7 @@ static const struct of_device_id atlas_dt_ids[] = {
 	{ .compatible = "atlas,ec-sm", .data = (void *)ATLAS_EC_SM, },
 	{ .compatible = "atlas,orp-sm", .data = (void *)ATLAS_ORP_SM, },
 	{ .compatible = "atlas,do-sm", .data = (void *)ATLAS_DO_SM, },
+	{ .compatible = "atlas,rtd-sm", .data = (void *)ATLAS_RTD_SM, },
 	{ }
 };
 MODULE_DEVICE_TABLE(of, atlas_dt_ids);
-- 
2.20.1


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

* Re: [PATCH v2 2/2] iio: chemical: atlas-sensor: add RTD-SM module support
  2020-04-19  6:05 ` [PATCH v2 2/2] iio: chemical: atlas-sensor: add RTD-SM module support Matt Ranostay
@ 2020-04-19  9:18   ` Peter Meerwald-Stadler
  2020-04-19 18:54     ` Matt Ranostay
  0 siblings, 1 reply; 5+ messages in thread
From: Peter Meerwald-Stadler @ 2020-04-19  9:18 UTC (permalink / raw)
  To: Matt Ranostay; +Cc: jic23, linux-iio

On Sun, 19 Apr 2020, Matt Ranostay wrote:

> Atlas Scientific RTD-SM OEM sensor reads temperate using

reads temperature?

> resistance temperature detector technology.
> 
> Signed-off-by: Matt Ranostay <matt.ranostay@konsulko.com>
> ---
>  drivers/iio/chemical/atlas-sensor.c | 28 ++++++++++++++++++++++++++++
>  1 file changed, 28 insertions(+)
> 
> diff --git a/drivers/iio/chemical/atlas-sensor.c b/drivers/iio/chemical/atlas-sensor.c
> index 82d470561ad3..c7ed9004cf82 100644
> --- a/drivers/iio/chemical/atlas-sensor.c
> +++ b/drivers/iio/chemical/atlas-sensor.c
> @@ -68,16 +68,20 @@
>  #define ATLAS_REG_DO_TEMP_DATA		0x12
>  #define ATLAS_REG_DO_DATA		0x22
>  
> +#define ATLAS_REG_RTD_DATA		0x0e

maybe keep registers in ascending order

> +
>  #define ATLAS_PH_INT_TIME_IN_MS		450
>  #define ATLAS_EC_INT_TIME_IN_MS		650
>  #define ATLAS_ORP_INT_TIME_IN_MS	450
>  #define ATLAS_DO_INT_TIME_IN_MS		450
> +#define ATLAS_RTD_INT_TIME_IN_MS	450
>  
>  enum {
>  	ATLAS_PH_SM,
>  	ATLAS_EC_SM,
>  	ATLAS_ORP_SM,
>  	ATLAS_DO_SM,
> +	ATLAS_RTD_SM,
>  };
>  
>  struct atlas_data {
> @@ -206,6 +210,22 @@ static const struct iio_chan_spec atlas_do_channels[] = {
>  	},
>  };
>  
> +static const struct iio_chan_spec atlas_rtd_channels[] = {
> +	{
> +		.type = IIO_TEMP,
> +		.address = ATLAS_REG_RTD_DATA,
> +		.info_mask_separate = BIT(IIO_CHAN_INFO_PROCESSED),
> +		.scan_index = 0,
> +		.scan_type = {
> +			.sign = 'u',

so this thing can't read negative temperature?

> +			.realbits = 32,
> +			.storagebits = 32,
> +			.endianness = IIO_BE,

_PROCESSED, but still stored as big endian? hm

> +		},
> +	},
> +	IIO_CHAN_SOFT_TIMESTAMP(1),
> +};
> +
>  static int atlas_check_ph_calibration(struct atlas_data *data)
>  {
>  	struct device *dev = &data->client->dev;
> @@ -350,6 +370,12 @@ static struct atlas_device atlas_devices[] = {
>  				.calibration = &atlas_check_do_calibration,
>  				.delay = ATLAS_DO_INT_TIME_IN_MS,
>  	},
> +	[ATLAS_RTD_SM] = {
> +				.channels = atlas_rtd_channels,
> +				.num_channels = 2,
> +				.data_reg = ATLAS_REG_RTD_DATA,
> +				.delay = ATLAS_RTD_INT_TIME_IN_MS,
> +	},
>  };
>  
>  static int atlas_set_powermode(struct atlas_data *data, int on)
> @@ -566,6 +592,7 @@ static const struct i2c_device_id atlas_id[] = {
>  	{ "atlas-ec-sm", ATLAS_EC_SM},
>  	{ "atlas-orp-sm", ATLAS_ORP_SM},
>  	{ "atlas-do-sm", ATLAS_DO_SM},
> +	{ "atlas-rtd-sm", ATLAS_RTD_SM},
>  	{}
>  };
>  MODULE_DEVICE_TABLE(i2c, atlas_id);
> @@ -575,6 +602,7 @@ static const struct of_device_id atlas_dt_ids[] = {
>  	{ .compatible = "atlas,ec-sm", .data = (void *)ATLAS_EC_SM, },
>  	{ .compatible = "atlas,orp-sm", .data = (void *)ATLAS_ORP_SM, },
>  	{ .compatible = "atlas,do-sm", .data = (void *)ATLAS_DO_SM, },
> +	{ .compatible = "atlas,rtd-sm", .data = (void *)ATLAS_RTD_SM, },
>  	{ }
>  };
>  MODULE_DEVICE_TABLE(of, atlas_dt_ids);
> 

-- 

Peter Meerwald-Stadler
Mobile: +43 664 24 44 418

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

* Re: [PATCH v2 2/2] iio: chemical: atlas-sensor: add RTD-SM module support
  2020-04-19  9:18   ` Peter Meerwald-Stadler
@ 2020-04-19 18:54     ` Matt Ranostay
  0 siblings, 0 replies; 5+ messages in thread
From: Matt Ranostay @ 2020-04-19 18:54 UTC (permalink / raw)
  To: Peter Meerwald-Stadler
  Cc: Jonathan Cameron, open list:IIO SUBSYSTEM AND DRIVERS

On Sun, Apr 19, 2020 at 2:18 AM Peter Meerwald-Stadler
<pmeerw@pmeerw.net> wrote:
>
> On Sun, 19 Apr 2020, Matt Ranostay wrote:
>
> > Atlas Scientific RTD-SM OEM sensor reads temperate using
>
> reads temperature?
Typo, will fix.

>
> > resistance temperature detector technology.
> >
> > Signed-off-by: Matt Ranostay <matt.ranostay@konsulko.com>
> > ---
> >  drivers/iio/chemical/atlas-sensor.c | 28 ++++++++++++++++++++++++++++
> >  1 file changed, 28 insertions(+)
> >
> > diff --git a/drivers/iio/chemical/atlas-sensor.c b/drivers/iio/chemical/atlas-sensor.c
> > index 82d470561ad3..c7ed9004cf82 100644
> > --- a/drivers/iio/chemical/atlas-sensor.c
> > +++ b/drivers/iio/chemical/atlas-sensor.c
> > @@ -68,16 +68,20 @@
> >  #define ATLAS_REG_DO_TEMP_DATA               0x12
> >  #define ATLAS_REG_DO_DATA            0x22
> >
> > +#define ATLAS_REG_RTD_DATA           0x0e
>
> maybe keep registers in ascending order
>
> > +
> >  #define ATLAS_PH_INT_TIME_IN_MS              450
> >  #define ATLAS_EC_INT_TIME_IN_MS              650
> >  #define ATLAS_ORP_INT_TIME_IN_MS     450
> >  #define ATLAS_DO_INT_TIME_IN_MS              450
> > +#define ATLAS_RTD_INT_TIME_IN_MS     450
> >
> >  enum {
> >       ATLAS_PH_SM,
> >       ATLAS_EC_SM,
> >       ATLAS_ORP_SM,
> >       ATLAS_DO_SM,
> > +     ATLAS_RTD_SM,
> >  };
> >
> >  struct atlas_data {
> > @@ -206,6 +210,22 @@ static const struct iio_chan_spec atlas_do_channels[] = {
> >       },
> >  };
> >
> > +static const struct iio_chan_spec atlas_rtd_channels[] = {
> > +     {
> > +             .type = IIO_TEMP,
> > +             .address = ATLAS_REG_RTD_DATA,
> > +             .info_mask_separate = BIT(IIO_CHAN_INFO_PROCESSED),
> > +             .scan_index = 0,
> > +             .scan_type = {
> > +                     .sign = 'u',
>
> so this thing can't read negative temperature?

Hmm good question. I'll ask Atlas since the datasheet says to -126 C
but doesn't note if it
is in two's complement or not

>
> > +                     .realbits = 32,
> > +                     .storagebits = 32,
> > +                     .endianness = IIO_BE,
>
> _PROCESSED, but still stored as big endian? hm

Ah should be _PROCESSED, but still need a entry in atlas_read_raw i
just noted to
read the value and be16_to_cpu

- Matt

>
> > +             },
> > +     },
> > +     IIO_CHAN_SOFT_TIMESTAMP(1),
> > +};
> > +
> >  static int atlas_check_ph_calibration(struct atlas_data *data)
> >  {
> >       struct device *dev = &data->client->dev;
> > @@ -350,6 +370,12 @@ static struct atlas_device atlas_devices[] = {
> >                               .calibration = &atlas_check_do_calibration,
> >                               .delay = ATLAS_DO_INT_TIME_IN_MS,
> >       },
> > +     [ATLAS_RTD_SM] = {
> > +                             .channels = atlas_rtd_channels,
> > +                             .num_channels = 2,
> > +                             .data_reg = ATLAS_REG_RTD_DATA,
> > +                             .delay = ATLAS_RTD_INT_TIME_IN_MS,
> > +     },
> >  };
> >
> >  static int atlas_set_powermode(struct atlas_data *data, int on)
> > @@ -566,6 +592,7 @@ static const struct i2c_device_id atlas_id[] = {
> >       { "atlas-ec-sm", ATLAS_EC_SM},
> >       { "atlas-orp-sm", ATLAS_ORP_SM},
> >       { "atlas-do-sm", ATLAS_DO_SM},
> > +     { "atlas-rtd-sm", ATLAS_RTD_SM},
> >       {}
> >  };
> >  MODULE_DEVICE_TABLE(i2c, atlas_id);
> > @@ -575,6 +602,7 @@ static const struct of_device_id atlas_dt_ids[] = {
> >       { .compatible = "atlas,ec-sm", .data = (void *)ATLAS_EC_SM, },
> >       { .compatible = "atlas,orp-sm", .data = (void *)ATLAS_ORP_SM, },
> >       { .compatible = "atlas,do-sm", .data = (void *)ATLAS_DO_SM, },
> > +     { .compatible = "atlas,rtd-sm", .data = (void *)ATLAS_RTD_SM, },
> >       { }
> >  };
> >  MODULE_DEVICE_TABLE(of, atlas_dt_ids);
> >
>
> --
>
> Peter Meerwald-Stadler
> Mobile: +43 664 24 44 418

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

end of thread, other threads:[~2020-04-19 18:54 UTC | newest]

Thread overview: 5+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2020-04-19  6:05 [PATCH v2 0/2] iio: chemical: atlas-sensor: add RTD-SM module support Matt Ranostay
2020-04-19  6:05 ` [PATCH v2 1/2] dt-bindings: iio: chemical: add Atlas Scientific RTD-SM sensor docs Matt Ranostay
2020-04-19  6:05 ` [PATCH v2 2/2] iio: chemical: atlas-sensor: add RTD-SM module support Matt Ranostay
2020-04-19  9:18   ` Peter Meerwald-Stadler
2020-04-19 18:54     ` Matt Ranostay

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.