mirror of
https://github.com/torvalds/linux.git
synced 2025-12-07 20:06:24 +00:00
iio: accel: bma220: turn power supplies on
Add devm_regulator_bulk_get_enable() to device probe(). Signed-off-by: Petre Rodan <petre.rodan@subdimension.ro> Signed-off-by: Jonathan Cameron <Jonathan.Cameron@huawei.com>
This commit is contained in:
committed by
Jonathan Cameron
parent
4a719f1826
commit
dfea5f181c
@@ -11,6 +11,7 @@
|
||||
#include <linux/module.h>
|
||||
#include <linux/mutex.h>
|
||||
#include <linux/pm.h>
|
||||
#include <linux/regulator/consumer.h>
|
||||
#include <linux/types.h>
|
||||
#include <linux/spi/spi.h>
|
||||
|
||||
@@ -231,6 +232,12 @@ static int bma220_init(struct spi_device *spi)
|
||||
{
|
||||
int ret;
|
||||
struct device *dev = &spi->dev;
|
||||
static const char * const regulator_names[] = { "vddd", "vddio", "vdda" };
|
||||
|
||||
ret = devm_regulator_bulk_get_enable(dev, ARRAY_SIZE(regulator_names),
|
||||
regulator_names);
|
||||
if (ret)
|
||||
return dev_err_probe(dev, ret, "Failed to get regulators\n");
|
||||
|
||||
ret = bma220_read_reg(spi, BMA220_REG_ID);
|
||||
if (ret < 0)
|
||||
|
||||
Reference in New Issue
Block a user