Lines Matching +full:humidity +full:- +full:sensor

1 // SPDX-License-Identifier: GPL-2.0-only
3 * htu21.c - Support for Measurement-Specialties
4 * htu21 temperature & humidity sensor
5 * and humidity part of MS8607 sensor
7 * Copyright (c) 2014 Measurement-Specialties
9 * (7-bit I2C slave address 0x40)
12 * http://www.meas-spec.com/downloads/HTU21D.pdf
14 * http://www.meas-spec.com/downloads/MS8607-02BA01.pdf
44 unsigned int humidity; in htu21_read_raw() local
49 switch (channel->type) { in htu21_read_raw()
60 &humidity); in htu21_read_raw()
63 *val = humidity; in htu21_read_raw()
67 return -EINVAL; in htu21_read_raw()
70 *val = htu21_samp_freq[dev_data->res_index]; in htu21_read_raw()
74 return -EINVAL; in htu21_read_raw()
88 while (i-- > 0) in htu21_write_raw()
92 return -EINVAL; in htu21_write_raw()
93 mutex_lock(&dev_data->lock); in htu21_write_raw()
94 dev_data->res_index = i; in htu21_write_raw()
96 mutex_unlock(&dev_data->lock); in htu21_write_raw()
100 return -EINVAL; in htu21_write_raw()
188 if (!i2c_check_functionality(client->adapter, in htu21_probe()
192 dev_err(&client->dev, in htu21_probe()
194 return -EOPNOTSUPP; in htu21_probe()
197 indio_dev = devm_iio_device_alloc(&client->dev, sizeof(*dev_data)); in htu21_probe()
199 return -ENOMEM; in htu21_probe()
202 dev_data->client = client; in htu21_probe()
203 dev_data->res_index = 0; in htu21_probe()
204 mutex_init(&dev_data->lock); in htu21_probe()
206 indio_dev->info = &htu21_info; in htu21_probe()
207 indio_dev->name = id->name; in htu21_probe()
208 indio_dev->modes = INDIO_DIRECT_MODE; in htu21_probe()
210 if (id->driver_data == MS8607) { in htu21_probe()
211 indio_dev->channels = ms8607_channels; in htu21_probe()
212 indio_dev->num_channels = ARRAY_SIZE(ms8607_channels); in htu21_probe()
214 indio_dev->channels = htu21_channels; in htu21_probe()
215 indio_dev->num_channels = ARRAY_SIZE(htu21_channels); in htu21_probe()
227 dev_info(&client->dev, "Serial number : %llx", serial_number); in htu21_probe()
229 return devm_iio_device_register(&client->dev, indio_dev); in htu21_probe()
234 {"ms8607-humidity", MS8607},
241 { .compatible = "meas,ms8607-humidity", },
257 MODULE_DESCRIPTION("Measurement-Specialties htu21 temperature and humidity driver");
258 MODULE_AUTHOR("William Markezana <william.markezana@meas-spec.com>");