Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux

iio: temperature: tmp117: add support for vcc-supply

Add support to specify the VCC supply which is required to power the
device. According the datasheet 7.3.1 Power Up, the device needs 1.5ms
after the supply voltage reaches the operating range before the
communcation can begin.

Signed-off-by: Thomas Haemmerle <thomas.haemmerle@leica-geosystems.com>
Signed-off-by: Marco Felsch <m.felsch@pengutronix.de>
Link: https://lore.kernel.org/r/20240219131114.134607-2-m.felsch@pengutronix.de
Signed-off-by: Jonathan Cameron <Jonathan.Cameron@huawei.com>

authored by

Thomas Haemmerle and committed by
Jonathan Cameron
42e03b0d 7d87c9b9

+9
+9
drivers/iio/temperature/tmp117.c
··· 9 9 * Note: This driver assumes that the sensor has been calibrated beforehand. 10 10 */ 11 11 12 + #include <linux/delay.h> 12 13 #include <linux/err.h> 13 14 #include <linux/i2c.h> 14 15 #include <linux/module.h> ··· 18 17 #include <linux/kernel.h> 19 18 #include <linux/limits.h> 20 19 #include <linux/property.h> 20 + #include <linux/regulator/consumer.h> 21 21 22 22 #include <linux/iio/iio.h> 23 23 ··· 150 148 struct tmp117_data *data; 151 149 struct iio_dev *indio_dev; 152 150 int dev_id; 151 + int ret; 153 152 154 153 if (!i2c_check_functionality(client->adapter, I2C_FUNC_SMBUS_WORD_DATA)) 155 154 return -EOPNOTSUPP; 155 + 156 + ret = devm_regulator_get_enable(&client->dev, "vcc"); 157 + if (ret) 158 + return ret; 159 + 160 + fsleep(1500); 156 161 157 162 dev_id = i2c_smbus_read_word_swapped(client, TMP117_REG_DEVICE_ID); 158 163 if (dev_id < 0)