Commit 5b4c63f6 authored by Andy Shevchenko's avatar Andy Shevchenko Committed by Jonathan Cameron

iio: accel: adxl345: Extract adxl345_powerup() helper

For the sake of symmetry and possible reuse in the future
extract adxl435_powerup() helper.
Signed-off-by: default avatarAndy Shevchenko <andriy.shevchenko@linux.intel.com>
Tested-by: default avatarKai-Heng Feng <kai.heng.feng@canonical.com>
Link: https://lore.kernel.org/r/20220222090009.2060-6-andriy.shevchenko@linux.intel.comSigned-off-by: default avatarJonathan Cameron <Jonathan.Cameron@huawei.com>
parent b9493d59
...@@ -209,6 +209,11 @@ static const struct iio_info adxl345_info = { ...@@ -209,6 +209,11 @@ static const struct iio_info adxl345_info = {
.write_raw_get_fmt = adxl345_write_raw_get_fmt, .write_raw_get_fmt = adxl345_write_raw_get_fmt,
}; };
static int adxl345_powerup(void *regmap)
{
return regmap_write(regmap, ADXL345_REG_POWER_CTL, ADXL345_POWER_CTL_MEASURE);
}
static void adxl345_powerdown(void *regmap) static void adxl345_powerdown(void *regmap)
{ {
regmap_write(regmap, ADXL345_REG_POWER_CTL, ADXL345_POWER_CTL_STANDBY); regmap_write(regmap, ADXL345_REG_POWER_CTL, ADXL345_POWER_CTL_STANDBY);
...@@ -265,8 +270,7 @@ int adxl345_core_probe(struct device *dev, struct regmap *regmap) ...@@ -265,8 +270,7 @@ int adxl345_core_probe(struct device *dev, struct regmap *regmap)
indio_dev->num_channels = ARRAY_SIZE(adxl345_channels); indio_dev->num_channels = ARRAY_SIZE(adxl345_channels);
/* Enable measurement mode */ /* Enable measurement mode */
ret = regmap_write(data->regmap, ADXL345_REG_POWER_CTL, ret = adxl345_powerup(data->regmap);
ADXL345_POWER_CTL_MEASURE);
if (ret < 0) if (ret < 0)
return dev_err_probe(dev, ret, "Failed to enable measurement mode\n"); return dev_err_probe(dev, ret, "Failed to enable measurement mode\n");
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment