SHT15 Sensiron humidity and temperature sensor
RFC 1/1 SHT15 Sensiron humidity and temperature sensor
From: Jonathan Cameron <[email protected]>
hwmon: SHT15 and similar Sensiron humidity sensors
---
Depends on:
Regulator: Add voltage change event notification
(to be posted to lkml shortly - it needs rebasing as that subsystem is changing rapidly at the mo!)
Data sheet at:
http://www.sensirion.ch/en/pdf/product_information/Datasheet-humidity-sensor-SHT1x.pdf
These sensors communicate over a 2 wire bus running a device specific protocol. The complexity of the driver is mainly due to handling the substantial delays between requesting a reading and the device pulling the data line low to indicate that the data is available. This is handled by an interrupt that is disabled under all other conditions.
I wasn't terribly clear on the best way to handle this, so comments on that aspect would be particularly welcome!
Interpretation of the temperature depends on knowing the supply voltage. If configured in a board config as a regulator consumer this is obtained from the regulator subsystem. If not it should be provided in the platform data.
I've placed this driver in the hwmon subsystem as it is definitely a device that may be used for hardware monitoring and with it's relatively slow response times (up to 120 milisecs to get a reading) a caching strategy certainly seems to make sense!
All comments welcome.
Who else should I run this by?
drivers/hwmon/Kconfig | 10 + drivers/hwmon/Makefile | 1 + drivers/hwmon/sht15.c | 673 ++++++++++++++++++++++++++++++++++++++++++++++++ include/linux/sht15.h | 24 ++ 4 files changed, 708 insertions(+), 0 deletions(-)
drivers/hwmon/Kconfig +10 -0
@@ -625,6 +625,16 @@ config SENSORS_PC87427 This driver can also be built as a module. If so, the module will be called pc87427. +config SENSORS_SHT15 + tristate "Sensiron humidity and temperature sensors. SHT15 and compat." + depends on GENERIC_GPIO + help + If you say yes here you get support for the Sensiron SHT10, SHT11, + SHT15, SHT71, SHT75 humidity and temperature sensors. + + This driver can also be built as a module. If so, the module + will be called sht15. + config SENSORS_SIS5595 tristate "Silicon Integrated Systems Corp. SiS5595" depends on PCI
drivers/hwmon/Makefile +1 -0
@@ -68,6 +68,7 @@ obj-$(CONFIG_SENSORS_MAX1619) += max1619.o obj-$(CONFIG_SENSORS_MAX6650) += max6650.o obj-$(CONFIG_SENSORS_PC87360) += pc87360.o obj-$(CONFIG_SENSORS_PC87427) += pc87427.o +obj-$(CONFIG_SENSORS_SHT15) += sht15.o obj-$(CONFIG_SENSORS_SIS5595) += sis5595.o obj-$(CONFIG_SENSORS_SMSC47B397)+= smsc47b397.o obj-$(CONFIG_SENSORS_SMSC47M1) += smsc47m1.o
drivers/hwmon/sht15.c new file +673 -0
673 lines not on this page · raw message
include/linux/sht15.h new file +23 -0
@@ -0,0 +1,24 @@ +/* +* sht15.h - support for the SHT15 Temperature and Humidity Sensor +* +* Copyright (c) 2009 Jonathan Cameron +* +* Copyright (c) 2007 Wouter Horre +* +* This program is free software; you can redistribute it and/or modify +* it under the terms of the GNU General Public License version 2 as +* published by the Free Software Foundation. +*/ + +/** +* struct sht15_platform_data - sht15 connectivity info +* @gpio_data: no. of gpio to which bidirectional data line is connected +* @gpio_sck: no. of gpio to which the data clock is connected. +* @supply_mv: supply voltage in mv. Overridden by regulator if available. +**/ +struct sht15_platform_data { +int gpio_data; +int gpio_sck; +int supply_mv; +};
_______________________________________________
lm-sensors mailing list
[email protected]
http://lists.lm-sensors.org/mailman/listinfo/lm-sensors
Re: [lm-sensors] [RFC] SHT15 Sensiron humidity and temperature
Quoted 9 lines · Jonathan Cameron
From: Jonathan Cameron <[email protected]>
hwmon: SHT15 and similar Sensiron humidity sensorsSigned-off-by Jonathan Cameron <[email protected]>---
Depends on:
Regulator: Add voltage change event notification
(to be posted to lkml shortly - it needs rebasing as that subsystem is changing rapidly at the mo!)
Dependency has now gone into the the voltage/for-next tree.
_______________________________________________
lm-sensors mailing list
[email protected]
http://lists.lm-sensors.org/mailman/listinfo/lm-sensors
Re: [lm-sensors] [RFC] SHT15 Sensiron humidity and temperature
In reply to Jonathan CameronQuoted 27 lines · On Sun, 18 Jan 2009 17:32:54 +0000 Jonathan Cameron <[email protected]> wrote:
From: Jonathan Cameron <[email protected]>
hwmon: SHT15 and similar Sensiron humidity sensorsSigned-off-by Jonathan Cameron <[email protected]>---
Depends on:
Regulator: Add voltage change event notification
(to be posted to lkml shortly - it needs rebasing as that subsystem is changing rapidly at the mo!)Data sheet at:
http://www.sensirion.ch/en/pdf/product_information/Datasheet-humidity-sensor-SHT1x.pdfThese sensors communicate over a 2 wire bus running a device specific protocol. The complexity of the driver is mainly due to handling the substantial delays between requesting a reading and the device pulling the data line low to indicate that the data is available. This is handled by an interrupt that is disabled under all other conditions.
I wasn't terribly clear on the best way to handle this, so comments on that aspect would be particularly welcome!
Interpretation of the temperature depends on knowing the supply voltage. If configured in a board config as a regulator consumer this is obtained from the regulator subsystem. If not it should be provided in the platform data.
Quoted 5 lines
I've placed this driver in the hwmon subsystem as it is definitely a device that may be used for hardware monitoring and with it's relatively slow response times (up to 120 milisecs to get a reading) a caching strategy certainly seems to make sense!
Building this in current kernels on x86_64 gives
drivers/hwmon/sht15.c: In function 'sht15_update_single_val':drivers/hwmon/sht15.c:237: error: implicit declaration of function 'IRQ_GPIO'
Quoted 13 lines
...
drivers/hwmon/sht15.c new file +10
-0+static int __init sht15_init (void ) +{ +int ret; +int i; + +for (i =0 ; i <ARRAY_SIZE (sht_drivers); i++) { + ret =platform_driver_register (&sht_drivers[i]); +if (ret) + goto error_unreg; + }
drivers/hwmon/sht15.c line 662
Quoted 10 lines
drivers/hwmon/sht15.c new file +10
-0+ +return 0 ; + +error_unreg: + i--; +for (; i >=0 ; i--) +platform_driver_unregister (&sht_drivers[i]); + +return ret; +}
We could just do
while (--i >= 0) platform_driver_unregister(...);
here.
Anyway, please take a look at those things and Cc: me on version 2 and we'll try to push forward with this, thanks.
_______________________________________________
lm-sensors mailing list
[email protected]
http://lists.lm-sensors.org/mailman/listinfo/lm-sensors
Re: [lm-sensors] [RFC] SHT15 Sensiron humidity and temperature
In reply to Jonathan CameronQuoted 3 lines · On Sun, 18 Jan 2009 17:32:54 +0000 Jonathan Cameron <[email protected]> wrote:
+/**
+ *sht15_send_bit()send and individual bit to the device
+ **/
One other thing...
The /** token is specifically for introducing kerneldoc-formatted comments. But this driver uses it for non-kerneldoc comments.
So please either convert the comments to kerneldoc form or use plain old
/*
* comment goes here
*/
Thanks.
_______________________________________________
lm-sensors mailing list
[email protected]
http://lists.lm-sensors.org/mailman/listinfo/lm-sensors