Lines Matching +full:iio +full:- +full:consumer
1 // SPDX-License-Identifier: GPL-2.0
7 * Based on linux/drivers/iio/adc/ti-tsc2046.c
12 #include <linux/gpio/consumer.h>
15 #include <linux/regulator/consumer.h>
18 #include <linux/iio/iio.h>
19 #include <linux/iio/buffer.h>
20 #include <linux/iio/driver.h>
21 #include <linux/iio/triggered_buffer.h>
22 #include <linux/iio/trigger_consumer.h>
46 * - IN Current (INC)
47 * - IN Voltage (INV)
134 * The ADC auto-decrements the register index with each clocked byte. in lmp92064_read_meas()
140 ret = regmap_bulk_read(priv->regmap, TI_LMP92064_REG_DATA_COUT_MSB, in lmp92064_read_meas()
144 dev_err(&priv->spi->dev, "regmap_bulk_read failed: %pe\n", in lmp92064_read_meas()
169 *val = (chan->address == TI_LMP92064_CHAN_INC) ? raw[0] : raw[1]; in lmp92064_read_raw()
173 if (chan->address == TI_LMP92064_CHAN_INC) { in lmp92064_read_raw()
180 *val2 = priv->shunt_resistor_uohm; in lmp92064_read_raw()
191 return -EINVAL; in lmp92064_read_raw()
198 struct iio_dev *indio_dev = pf->indio_dev; in lmp92064_trigger_handler()
216 iio_trigger_notify_done(indio_dev->trig); in lmp92064_trigger_handler()
241 * Perform a soft-reset if not. in lmp92064_reset()
245 ret = regmap_write(priv->regmap, TI_LMP92064_REG_CONFIG_A, in lmp92064_reset()
250 ret = regmap_write(priv->regmap, TI_LMP92064_REG_CONFIG_B, in lmp92064_reset()
260 * not more than 3-4 iterations of this loop. in lmp92064_reset()
263 ret = regmap_read(priv->regmap, TI_LMP92064_REG_STATUS, &status); in lmp92064_reset()
277 return -ENXIO; in lmp92064_reset()
286 struct device *dev = &spi->dev; in lmp92064_adc_probe()
305 return -ENOMEM; in lmp92064_adc_probe()
309 priv->spi = spi; in lmp92064_adc_probe()
310 priv->regmap = regmap; in lmp92064_adc_probe()
312 ret = device_property_read_u32(dev, "shunt-resistor-micro-ohms", in lmp92064_adc_probe()
316 "Failed to get shunt-resistor value\n"); in lmp92064_adc_probe()
319 * The shunt resistance is passed to userspace as the denominator of an iio in lmp92064_adc_probe()
324 return -EINVAL; in lmp92064_adc_probe()
327 priv->shunt_resistor_uohm = shunt_resistor_uohm; in lmp92064_adc_probe()
346 indio_dev->name = "lmp92064"; in lmp92064_adc_probe()
347 indio_dev->modes = INDIO_DIRECT_MODE; in lmp92064_adc_probe()
348 indio_dev->channels = lmp92064_adc_channels; in lmp92064_adc_probe()
349 indio_dev->num_channels = ARRAY_SIZE(lmp92064_adc_channels); in lmp92064_adc_probe()
350 indio_dev->info = &lmp92064_adc_info; in lmp92064_adc_probe()
351 indio_dev->available_scan_masks = lmp92064_scan_masks; in lmp92064_adc_probe()