aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/iio
diff options
context:
space:
mode:
authorThomas Haemmerle <thomas.haemmerle@leica-geosystems.com>2024-02-19 14:11:14 +0100
committerJonathan Cameron <Jonathan.Cameron@huawei.com>2024-02-28 19:26:35 +0000
commit42e03b0d371a61478ac6fd992bb4183bdccb3028 (patch)
treed8cd5a2346f1abd0d7a69d830407bebfea18e773 /drivers/iio
parent7d87c9b94a44bed97637199a62e99c702f8469d0 (diff)
downloadlinux-42e03b0d371a61478ac6fd992bb4183bdccb3028.tar.gz
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>
Diffstat (limited to 'drivers/iio')
-rw-r--r--drivers/iio/temperature/tmp117.c9
1 files changed, 9 insertions, 0 deletions
diff --git a/drivers/iio/temperature/tmp117.c b/drivers/iio/temperature/tmp117.c
index 059953015ae724..8972083d903a25 100644
--- a/drivers/iio/temperature/tmp117.c
+++ b/drivers/iio/temperature/tmp117.c
@@ -9,6 +9,7 @@
* Note: This driver assumes that the sensor has been calibrated beforehand.
*/
+#include <linux/delay.h>
#include <linux/err.h>
#include <linux/i2c.h>
#include <linux/module.h>
@@ -17,6 +18,7 @@
#include <linux/kernel.h>
#include <linux/limits.h>
#include <linux/property.h>
+#include <linux/regulator/consumer.h>
#include <linux/iio/iio.h>
@@ -148,10 +150,17 @@ static int tmp117_probe(struct i2c_client *client)
struct tmp117_data *data;
struct iio_dev *indio_dev;
int dev_id;
+ int ret;
if (!i2c_check_functionality(client->adapter, I2C_FUNC_SMBUS_WORD_DATA))
return -EOPNOTSUPP;
+ ret = devm_regulator_get_enable(&client->dev, "vcc");
+ if (ret)
+ return ret;
+
+ fsleep(1500);
+
dev_id = i2c_smbus_read_word_swapped(client, TMP117_REG_DEVICE_ID);
if (dev_id < 0)
return dev_id;