Lines Matching +full:humidity +full:- +full:sensor
1 // SPDX-License-Identifier: GPL-2.0+
3 * hdc2010.c - Support for the TI HDC2010 and HDC2080
4 * temperature + relative humidity sensors
110 u8 tmp = (~mask & data->drdy_config) | val; in hdc2010_update_drdy_config()
113 ret = i2c_smbus_write_byte_data(data->client, in hdc2010_update_drdy_config()
118 data->drdy_config = tmp; in hdc2010_update_drdy_config()
126 struct i2c_client *client = data->client; in hdc2010_get_prim_measurement_word()
130 hdc2010_reg_translation[chan->address].primary); in hdc2010_get_prim_measurement_word()
133 dev_err(&client->dev, "Could not read sensor measurement word\n"); in hdc2010_get_prim_measurement_word()
141 struct i2c_client *client = data->client; in hdc2010_get_peak_measurement_byte()
145 hdc2010_reg_translation[chan->address].peak); in hdc2010_get_peak_measurement_byte()
148 dev_err(&client->dev, "Could not read sensor measurement byte\n"); in hdc2010_get_peak_measurement_byte()
155 return !!(data->drdy_config & HDC2010_HEATER_EN); in hdc2010_get_heater_status()
168 if (chan->type == IIO_CURRENT) { in hdc2010_read_raw()
173 return -EBUSY; in hdc2010_read_raw()
174 mutex_lock(&data->lock); in hdc2010_read_raw()
176 mutex_unlock(&data->lock); in hdc2010_read_raw()
187 return -EBUSY; in hdc2010_read_raw()
188 mutex_lock(&data->lock); in hdc2010_read_raw()
190 mutex_unlock(&data->lock); in hdc2010_read_raw()
200 if (chan->type == IIO_TEMP) in hdc2010_read_raw()
206 *val = -15887; in hdc2010_read_raw()
210 return -EINVAL; in hdc2010_read_raw()
223 if (chan->type != IIO_CURRENT || val2 != 0) in hdc2010_write_raw()
224 return -EINVAL; in hdc2010_write_raw()
234 return -EINVAL; in hdc2010_write_raw()
237 mutex_lock(&data->lock); in hdc2010_write_raw()
239 mutex_unlock(&data->lock); in hdc2010_write_raw()
242 return -EINVAL; in hdc2010_write_raw()
259 if (!i2c_check_functionality(client->adapter, in hdc2010_probe()
261 return -EOPNOTSUPP; in hdc2010_probe()
263 indio_dev = devm_iio_device_alloc(&client->dev, sizeof(*data)); in hdc2010_probe()
265 return -ENOMEM; in hdc2010_probe()
269 data->client = client; in hdc2010_probe()
270 mutex_init(&data->lock); in hdc2010_probe()
276 indio_dev->name = "hdc2010"; in hdc2010_probe()
277 indio_dev->modes = INDIO_DIRECT_MODE; in hdc2010_probe()
278 indio_dev->info = &hdc2010_info; in hdc2010_probe()
280 indio_dev->channels = hdc2010_channels; in hdc2010_probe()
281 indio_dev->num_channels = ARRAY_SIZE(hdc2010_channels); in hdc2010_probe()
289 * We enable both temp and humidity measurement. in hdc2010_probe()
292 tmp = (data->measurement_config & ~HDC2010_MEAS_CONF) | in hdc2010_probe()
297 dev_warn(&client->dev, "Unable to set up measurement\n"); in hdc2010_probe()
299 dev_warn(&client->dev, "Unable to restore default AMM\n"); in hdc2010_probe()
303 data->measurement_config = tmp; in hdc2010_probe()
317 dev_warn(&client->dev, "Unable to restore default AMM\n"); in hdc2010_remove()
346 MODULE_DESCRIPTION("TI HDC2010 humidity and temperature sensor driver");