Commit 7c84f7f8 authored by David Frey's avatar David Frey Committed by Guenter Roeck

hwmon: add support for Sensirion SHT3x sensors

This driver implements support for the Sensirion SHT3x-DIS chip,
a humidity and temperature sensor. Temperature is measured
in degrees celsius, relative humidity is expressed as a percentage.
In the sysfs interface, all values are scaled by 1000,
i.e. the value for 31.5 degrees celsius is 31500.
Signed-off-by: default avatarPascal Sachs <pascal.sachs@sensirion.com>
[groeck: Fixed 'Variable length array is used' gcc warning]
Signed-off-by: default avatarGuenter Roeck <linux@roeck-us.net>
parent 76b5808e
Kernel driver sht3x
===================
Supported chips:
* Sensirion SHT3x-DIS
Prefix: 'sht3x'
Addresses scanned: none
Datasheet: http://www.sensirion.com/fileadmin/user_upload/customers/sensirion/Dokumente/Humidity/Sensirion_Humidity_Datasheet_SHT3x_DIS.pdf
Author:
David Frey <david.frey@sensirion.com>
Pascal Sachs <pascal.sachs@sensirion.com>
Description
-----------
This driver implements support for the Sensirion SHT3x-DIS chip, a humidity
and temperature sensor. Temperature is measured in degrees celsius, relative
humidity is expressed as a percentage. In the sysfs interface, all values are
scaled by 1000, i.e. the value for 31.5 degrees celsius is 31500.
The device communicates with the I2C protocol. Sensors can have the I2C
addresses 0x44 or 0x45, depending on the wiring. See
Documentation/i2c/instantiating-devices for methods to instantiate the device.
There are two options configurable by means of sht3x_platform_data:
1. blocking (pull the I2C clock line down while performing the measurement) or
non-blocking mode. Blocking mode will guarantee the fastest result but
the I2C bus will be busy during that time. By default, non-blocking mode
is used. Make sure clock-stretching works properly on your device if you
want to use blocking mode.
2. high or low accuracy. High accuracy is used by default and using it is
strongly recommended.
The sht3x sensor supports a single shot mode as well as 5 periodic measure
modes, which can be controlled with the update_interval sysfs interface.
The allowed update_interval in milliseconds are as follows:
* 0 single shot mode
* 2000 0.5 Hz periodic measurement
* 1000 1 Hz periodic measurement
* 500 2 Hz periodic measurement
* 250 4 Hz periodic measurement
* 100 10 Hz periodic measurement
In the periodic measure mode, the sensor automatically triggers a measurement
with the configured update interval on the chip. When a temperature or humidity
reading exceeds the configured limits, the alert attribute is set to 1 and
the alert pin on the sensor is set to high.
When the temperature and humidity readings move back between the hysteresis
values, the alert bit is set to 0 and the alert pin on the sensor is set to
low.
sysfs-Interface
---------------
temp1_input: temperature input
humidity1_input: humidity input
temp1_max: temperature max value
temp1_max_hyst: temperature hysteresis value for max limit
humidity1_max: humidity max value
humidity1_max_hyst: humidity hysteresis value for max limit
temp1_min: temperature min value
temp1_min_hyst: temperature hysteresis value for min limit
humidity1_min: humidity min value
humidity1_min_hyst: humidity hysteresis value for min limit
temp1_alarm: alarm flag is set to 1 if the temperature is outside the
configured limits. Alarm only works in periodic measure mode
humidity1_alarm: alarm flag is set to 1 if the humidity is outside the
configured limits. Alarm only works in periodic measure mode
update_interval: update interval, 0 for single shot, interval in msec
for periodic measurement. If the interval is not supported
by the sensor, the next faster interval is chosen
......@@ -1265,6 +1265,17 @@ config SENSORS_SHT21
This driver can also be built as a module. If so, the module
will be called sht21.
config SENSORS_SHT3x
tristate "Sensiron humidity and temperature sensors. SHT3x and compat."
depends on I2C
select CRC8
help
If you say yes here you get support for the Sensiron SHT30 and SHT31
humidity and temperature sensors.
This driver can also be built as a module. If so, the module
will be called sht3x.
config SENSORS_SHTC1
tristate "Sensiron humidity and temperature sensors. SHTC1 and compat."
depends on I2C
......
......@@ -138,6 +138,7 @@ obj-$(CONFIG_SENSORS_SCH5627) += sch5627.o
obj-$(CONFIG_SENSORS_SCH5636) += sch5636.o
obj-$(CONFIG_SENSORS_SHT15) += sht15.o
obj-$(CONFIG_SENSORS_SHT21) += sht21.o
obj-$(CONFIG_SENSORS_SHT3x) += sht3x.o
obj-$(CONFIG_SENSORS_SHTC1) += shtc1.o
obj-$(CONFIG_SENSORS_SIS5595) += sis5595.o
obj-$(CONFIG_SENSORS_SMM665) += smm665.o
......
This diff is collapsed.
/*
* Copyright (C) 2016 Sensirion AG, Switzerland
* Author: David Frey <david.frey@sensirion.com>
* Author: Pascal Sachs <pascal.sachs@sensirion.com>
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 2 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
*/
#ifndef __SHT3X_H_
#define __SHT3X_H_
struct sht3x_platform_data {
bool blocking_io;
bool high_precision;
};
#endif /* __SHT3X_H_ */
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment