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

Configure Feed

Select the types of activity you want to include in your feed.

iio: light: vcnl4000: add support for regulators

Add supply, I2C and cathode voltage regulators to the sensor and enable
them. This keeps the sensor powered on even after its only supply shared
by another device shuts down.

Reported-by: Raymond Hackley <raymondhackley@protonmail.com>
Reviewed-by: David Lechner <dlechner@baylibre.com>
Signed-off-by: Erikas Bitovtas <xerikasxx@gmail.com>
Reviewed-by: Andy Shevchenko <andriy.shevchenko@intel.com>
Signed-off-by: Jonathan Cameron <Jonathan.Cameron@huawei.com>

authored by

Erikas Bitovtas and committed by
Jonathan Cameron
773a5dc6 5ec96d77

+7
+7
drivers/iio/light/vcnl4000.c
··· 24 24 #include <linux/interrupt.h> 25 25 #include <linux/module.h> 26 26 #include <linux/pm_runtime.h> 27 + #include <linux/regulator/consumer.h> 27 28 #include <linux/units.h> 28 29 29 30 #include <linux/iio/buffer.h> ··· 1986 1985 static int vcnl4000_probe(struct i2c_client *client) 1987 1986 { 1988 1987 const struct i2c_device_id *id = i2c_client_get_device_id(client); 1988 + const char * const regulator_names[] = { "vdd", "vio", "vled" }; 1989 1989 struct device *dev = &client->dev; 1990 1990 struct vcnl4000_data *data; 1991 1991 struct iio_dev *indio_dev; ··· 2001 1999 data->client = client; 2002 2000 data->id = id->driver_data; 2003 2001 data->chip_spec = &vcnl4000_chip_spec_cfg[data->id]; 2002 + 2003 + ret = devm_regulator_bulk_get_enable(dev, ARRAY_SIZE(regulator_names), 2004 + regulator_names); 2005 + if (ret) 2006 + return ret; 2004 2007 2005 2008 ret = devm_mutex_init(dev, &data->vcnl4000_lock); 2006 2009 if (ret)