Lines Matching +full:wp +full:- +full:content

1 // SPDX-License-Identifier: GPL-2.0+
3 * ens210.c - Support for ScioSense ens210 temperature & humidity sensor family
5 * (7-bit I2C slave address 0x43 ENS210)
6 * (7-bit I2C slave address 0x43 ENS210A)
7 * (7-bit I2C slave address 0x44 ENS211)
8 * (7-bit I2C slave address 0x45 ENS212)
9 * (7-bit I2C slave address 0x46 ENS213A)
10 * (7-bit I2C slave address 0x47 ENS215)
13 * https://www.sciosense.com/wp-content/uploads/2024/04/ENS21x-Datasheet.pdf
14 * https://www.sciosense.com/wp-content/uploads/2023/12/ENS210-Datasheet.pdf
62 * struct ens210_chip_info - Humidity/Temperature chip specific information
74 * struct ens210_data - Humidity/Temperature sensor device structure
86 /* calculate 17-bit crc7 */
97 struct device *dev = &data->client->dev; in ens210_get_measurement()
103 ret = i2c_smbus_write_byte_data(data->client, ENS210_REG_SENS_START, in ens210_get_measurement()
110 msleep(data->chip_info->conv_time_msec); in ens210_get_measurement()
112 ret = i2c_smbus_read_byte_data(data->client, ENS210_REG_SENS_STAT); in ens210_get_measurement()
118 data->client, temp ? ENS210_REG_T_VAL : ENS210_REG_H_VAL, 3, in ens210_get_measurement()
122 return -EIO; in ens210_get_measurement()
126 return -EIO; in ens210_get_measurement()
132 return -EIO; in ens210_get_measurement()
137 return -EIO; in ens210_get_measurement()
153 scoped_guard(mutex, &data->lock) { in ens210_read_raw()
155 indio_dev, channel->type == IIO_TEMP, val); in ens210_read_raw()
160 return -EINVAL; /* compiler warning workaround */ in ens210_read_raw()
162 if (channel->type == IIO_TEMP) { in ens210_read_raw()
171 *val = -17481; in ens210_read_raw()
175 return -EINVAL; in ens210_read_raw()
204 if (!i2c_check_functionality(client->adapter, in ens210_probe()
208 return dev_err_probe(&client->dev, -EOPNOTSUPP, in ens210_probe()
212 indio_dev = devm_iio_device_alloc(&client->dev, sizeof(*data)); in ens210_probe()
214 return -ENOMEM; in ens210_probe()
217 data->client = client; in ens210_probe()
218 mutex_init(&data->lock); in ens210_probe()
219 data->chip_info = i2c_get_match_data(client); in ens210_probe()
221 ret = devm_regulator_get_enable(&client->dev, "vdd"); in ens210_probe()
248 if (part_id != data->chip_info->part_id) { in ens210_probe()
249 dev_info(&client->dev, in ens210_probe()
251 data->chip_info->part_id); in ens210_probe()
260 indio_dev->name = data->chip_info->name; in ens210_probe()
261 indio_dev->modes = INDIO_DIRECT_MODE; in ens210_probe()
262 indio_dev->channels = ens210_channels; in ens210_probe()
263 indio_dev->num_channels = ARRAY_SIZE(ens210_channels); in ens210_probe()
264 indio_dev->info = &ens210_info; in ens210_probe()
266 return devm_iio_device_register(&client->dev, indio_dev); in ens210_probe()