struct device_attribute *attr,
char *buf)
{
- struct iio_dev *dev_info = dev_get_drvdata(dev);
- struct ad7150_chip_info *chip = iio_priv(dev_info);
+ struct iio_dev *indio_dev = dev_get_drvdata(dev);
+ struct ad7150_chip_info *chip = iio_priv(indio_dev);
struct iio_dev_attr *this_attr = to_iio_dev_attr(attr);
u8 value;
struct attribute *attr, int n)
{
struct device *dev = container_of(kobj, struct device, kobj);
- struct iio_dev *dev_info = dev_get_drvdata(dev);
- struct ad7192_state *st = iio_priv(dev_info);
+ struct iio_dev *indio_dev = dev_get_drvdata(dev);
+ struct ad7192_state *st = iio_priv(indio_dev);
mode_t mode = attr->mode;
struct device_attribute *attr,
char *buf)
{
- struct iio_dev *dev_info = dev_get_drvdata(dev);
- struct ad7280_state *st = iio_priv(dev_info);
+ struct iio_dev *indio_dev = dev_get_drvdata(dev);
+ struct ad7280_state *st = iio_priv(indio_dev);
struct iio_dev_attr *this_attr = to_iio_dev_attr(attr);
return sprintf(buf, "%d\n",
const char *buf,
size_t len)
{
- struct iio_dev *dev_info = dev_get_drvdata(dev);
- struct ad7280_state *st = iio_priv(dev_info);
+ struct iio_dev *indio_dev = dev_get_drvdata(dev);
+ struct ad7280_state *st = iio_priv(indio_dev);
struct iio_dev_attr *this_attr = to_iio_dev_attr(attr);
bool readin;
int ret;
devaddr = this_attr->address >> 8;
ch = this_attr->address & 0xFF;
- mutex_lock(&dev_info->mlock);
+ mutex_lock(&indio_dev->mlock);
if (readin)
st->cb_mask[devaddr] |= 1 << (ch + 2);
else
ret = ad7280_write(st, devaddr, AD7280A_CELL_BALANCE,
0, st->cb_mask[devaddr]);
- mutex_unlock(&dev_info->mlock);
+ mutex_unlock(&indio_dev->mlock);
return ret ? ret : len;
}
struct device_attribute *attr,
char *buf)
{
- struct iio_dev *dev_info = dev_get_drvdata(dev);
- struct ad7280_state *st = iio_priv(dev_info);
+ struct iio_dev *indio_dev = dev_get_drvdata(dev);
+ struct ad7280_state *st = iio_priv(indio_dev);
struct iio_dev_attr *this_attr = to_iio_dev_attr(attr);
int ret;
unsigned msecs;
- mutex_lock(&dev_info->mlock);
+ mutex_lock(&indio_dev->mlock);
ret = ad7280_read(st, this_attr->address >> 8,
this_attr->address & 0xFF);
- mutex_unlock(&dev_info->mlock);
+ mutex_unlock(&indio_dev->mlock);
if (ret < 0)
return ret;
const char *buf,
size_t len)
{
- struct iio_dev *dev_info = dev_get_drvdata(dev);
- struct ad7280_state *st = iio_priv(dev_info);
+ struct iio_dev *indio_dev = dev_get_drvdata(dev);
+ struct ad7280_state *st = iio_priv(indio_dev);
struct iio_dev_attr *this_attr = to_iio_dev_attr(attr);
long val;
int ret;
if (val > 31)
return -EINVAL;
- mutex_lock(&dev_info->mlock);
+ mutex_lock(&indio_dev->mlock);
ret = ad7280_write(st, this_attr->address >> 8,
this_attr->address & 0xFF,
0, (val & 0x1F) << 3);
- mutex_unlock(&dev_info->mlock);
+ mutex_unlock(&indio_dev->mlock);
return ret ? ret : len;
}
struct device_attribute *attr,
char *buf)
{
- struct iio_dev *dev_info = dev_get_drvdata(dev);
- struct ad7280_state *st = iio_priv(dev_info);
+ struct iio_dev *indio_dev = dev_get_drvdata(dev);
+ struct ad7280_state *st = iio_priv(indio_dev);
struct iio_dev_attr *this_attr = to_iio_dev_attr(attr);
unsigned val;
const char *buf,
size_t len)
{
- struct iio_dev *dev_info = dev_get_drvdata(dev);
- struct ad7280_state *st = iio_priv(dev_info);
+ struct iio_dev *indio_dev = dev_get_drvdata(dev);
+ struct ad7280_state *st = iio_priv(indio_dev);
struct iio_dev_attr *this_attr = to_iio_dev_attr(attr);
long val;
val = clamp(val, 0L, 0xFFL);
- mutex_lock(&dev_info->mlock);
+ mutex_lock(&indio_dev->mlock);
switch (this_attr->address) {
case AD7280A_CELL_OVERVOLTAGE:
st->cell_threshhigh = val;
ret = ad7280_write(st, AD7280A_DEVADDR_MASTER,
this_attr->address, 1, val);
- mutex_unlock(&dev_info->mlock);
+ mutex_unlock(&indio_dev->mlock);
return ret ? ret : len;
}
static irqreturn_t ad7280_event_handler(int irq, void *private)
{
- struct iio_dev *dev_info = private;
- struct ad7280_state *st = iio_priv(dev_info);
+ struct iio_dev *indio_dev = private;
+ struct ad7280_state *st = iio_priv(indio_dev);
unsigned *channels;
int i, ret;
if (((channels[i] >> 23) & 0xF) <= AD7280A_CELL_VOLTAGE_6) {
if (((channels[i] >> 11) & 0xFFF) >=
st->cell_threshhigh)
- iio_push_event(dev_info,
+ iio_push_event(indio_dev,
IIO_EVENT_CODE(IIO_VOLTAGE,
1,
0,
iio_get_time_ns());
else if (((channels[i] >> 11) & 0xFFF) <=
st->cell_threshlow)
- iio_push_event(dev_info,
+ iio_push_event(indio_dev,
IIO_EVENT_CODE(IIO_VOLTAGE,
1,
0,
iio_get_time_ns());
} else {
if (((channels[i] >> 11) & 0xFFF) >= st->aux_threshhigh)
- iio_push_event(dev_info,
+ iio_push_event(indio_dev,
IIO_UNMOD_EVENT_CODE(IIO_TEMP,
0,
IIO_EV_TYPE_THRESH,
iio_get_time_ns());
else if (((channels[i] >> 11) & 0xFFF) <=
st->aux_threshlow)
- iio_push_event(dev_info,
+ iio_push_event(indio_dev,
IIO_UNMOD_EVENT_CODE(IIO_TEMP,
0,
IIO_EV_TYPE_THRESH,
.attrs = ad7280_event_attributes,
};
-static int ad7280_read_raw(struct iio_dev *dev_info,
+static int ad7280_read_raw(struct iio_dev *indio_dev,
struct iio_chan_spec const *chan,
int *val,
int *val2,
long m)
{
- struct ad7280_state *st = iio_priv(dev_info);
+ struct ad7280_state *st = iio_priv(indio_dev);
unsigned int scale_uv;
int ret;
switch (m) {
case 0:
- mutex_lock(&dev_info->mlock);
+ mutex_lock(&indio_dev->mlock);
if (chan->address == AD7280A_ALL_CELLS)
ret = ad7280_read_all_channels(st, st->scan_cnt, NULL);
else
ret = ad7280_read_channel(st, chan->address >> 8,
chan->address & 0xFF);
- mutex_unlock(&dev_info->mlock);
+ mutex_unlock(&indio_dev->mlock);
if (ret < 0)
return ret;
const char *buf,
size_t len)
{
- struct iio_dev *dev_info = dev_get_drvdata(dev);
- struct ad7291_chip_info *chip = iio_priv(dev_info);
+ struct iio_dev *indio_dev = dev_get_drvdata(dev);
+ struct ad7291_chip_info *chip = iio_priv(indio_dev);
return ad7291_i2c_write(chip, AD7291_COMMAND,
chip->command | AD7291_RESET);
struct device_attribute *attr,
char *buf)
{
- struct iio_dev *dev_info = dev_get_drvdata(dev);
- struct ad7291_chip_info *chip = iio_priv(dev_info);
+ struct iio_dev *indio_dev = dev_get_drvdata(dev);
+ struct ad7291_chip_info *chip = iio_priv(indio_dev);
struct iio_dev_attr *this_attr = to_iio_dev_attr(attr);
u16 data;
int ret;
const char *buf,
size_t len)
{
- struct iio_dev *dev_info = dev_get_drvdata(dev);
- struct ad7291_chip_info *chip = iio_priv(dev_info);
+ struct iio_dev *indio_dev = dev_get_drvdata(dev);
+ struct ad7291_chip_info *chip = iio_priv(indio_dev);
struct iio_dev_attr *this_attr = to_iio_dev_attr(attr);
u16 data;
int ret;
return 0;
}
-static int ad7298_read_raw(struct iio_dev *dev_info,
+static int ad7298_read_raw(struct iio_dev *indio_dev,
struct iio_chan_spec const *chan,
int *val,
int *val2,
long m)
{
int ret;
- struct ad7298_state *st = iio_priv(dev_info);
+ struct ad7298_state *st = iio_priv(indio_dev);
unsigned int scale_uv;
switch (m) {
case 0:
- mutex_lock(&dev_info->mlock);
- if (iio_buffer_enabled(dev_info)) {
+ mutex_lock(&indio_dev->mlock);
+ if (iio_buffer_enabled(indio_dev)) {
if (chan->address == AD7298_CH_TEMP)
ret = -ENODEV;
else
- ret = ad7298_scan_from_ring(dev_info,
+ ret = ad7298_scan_from_ring(indio_dev,
chan->address);
} else {
if (chan->address == AD7298_CH_TEMP)
else
ret = ad7298_scan_direct(st, chan->address);
}
- mutex_unlock(&dev_info->mlock);
+ mutex_unlock(&indio_dev->mlock);
if (ret < 0)
return ret;
#include "ad7298.h"
-int ad7298_scan_from_ring(struct iio_dev *dev_info, long ch)
+int ad7298_scan_from_ring(struct iio_dev *indio_dev, long ch)
{
- struct iio_buffer *ring = dev_info->buffer;
+ struct iio_buffer *ring = indio_dev->buffer;
int ret;
u16 *ring_data;
return (st->data[0] << 8) | st->data[1];
}
-static int ad7476_read_raw(struct iio_dev *dev_info,
+static int ad7476_read_raw(struct iio_dev *indio_dev,
struct iio_chan_spec const *chan,
int *val,
int *val2,
long m)
{
int ret;
- struct ad7476_state *st = iio_priv(dev_info);
+ struct ad7476_state *st = iio_priv(indio_dev);
unsigned int scale_uv;
switch (m) {
case 0:
- mutex_lock(&dev_info->mlock);
- if (iio_buffer_enabled(dev_info))
- ret = ad7476_scan_from_ring(dev_info);
+ mutex_lock(&indio_dev->mlock);
+ if (iio_buffer_enabled(indio_dev))
+ ret = ad7476_scan_from_ring(indio_dev);
else
ret = ad7476_scan_direct(st);
- mutex_unlock(&dev_info->mlock);
+ mutex_unlock(&indio_dev->mlock);
if (ret < 0)
return ret;
struct device_attribute *attr,
char *buf)
{
- struct iio_dev *dev_info = dev_get_drvdata(dev);
- struct ad7816_chip_info *chip = iio_priv(dev_info);
+ struct iio_dev *indio_dev = dev_get_drvdata(dev);
+ struct ad7816_chip_info *chip = iio_priv(indio_dev);
if (chip->mode)
return sprintf(buf, "power-save\n");
const char *buf,
size_t len)
{
- struct iio_dev *dev_info = dev_get_drvdata(dev);
- struct ad7816_chip_info *chip = iio_priv(dev_info);
+ struct iio_dev *indio_dev = dev_get_drvdata(dev);
+ struct ad7816_chip_info *chip = iio_priv(indio_dev);
if (strcmp(buf, "full")) {
gpio_set_value(chip->rdwr_pin, 1);
struct device_attribute *attr,
char *buf)
{
- struct iio_dev *dev_info = dev_get_drvdata(dev);
- struct ad7816_chip_info *chip = iio_priv(dev_info);
+ struct iio_dev *indio_dev = dev_get_drvdata(dev);
+ struct ad7816_chip_info *chip = iio_priv(indio_dev);
return sprintf(buf, "%d\n", chip->channel_id);
}
const char *buf,
size_t len)
{
- struct iio_dev *dev_info = dev_get_drvdata(dev);
- struct ad7816_chip_info *chip = iio_priv(dev_info);
+ struct iio_dev *indio_dev = dev_get_drvdata(dev);
+ struct ad7816_chip_info *chip = iio_priv(indio_dev);
unsigned long data;
int ret;
if (data > AD7816_CS_MAX && data != AD7816_CS_MASK) {
dev_err(&chip->spi_dev->dev, "Invalid channel id %lu for %s.\n",
- data, dev_info->name);
+ data, indio_dev->name);
return -EINVAL;
- } else if (strcmp(dev_info->name, "ad7818") == 0 && data > 1) {
+ } else if (strcmp(indio_dev->name, "ad7818") == 0 && data > 1) {
dev_err(&chip->spi_dev->dev,
"Invalid channel id %lu for ad7818.\n", data);
return -EINVAL;
- } else if (strcmp(dev_info->name, "ad7816") == 0 && data > 0) {
+ } else if (strcmp(indio_dev->name, "ad7816") == 0 && data > 0) {
dev_err(&chip->spi_dev->dev,
"Invalid channel id %lu for ad7816.\n", data);
return -EINVAL;
struct device_attribute *attr,
char *buf)
{
- struct iio_dev *dev_info = dev_get_drvdata(dev);
- struct ad7816_chip_info *chip = iio_priv(dev_info);
+ struct iio_dev *indio_dev = dev_get_drvdata(dev);
+ struct ad7816_chip_info *chip = iio_priv(indio_dev);
u16 data;
s8 value;
int ret;
struct device_attribute *attr,
char *buf)
{
- struct iio_dev *dev_info = dev_get_drvdata(dev);
- struct ad7816_chip_info *chip = iio_priv(dev_info);
+ struct iio_dev *indio_dev = dev_get_drvdata(dev);
+ struct ad7816_chip_info *chip = iio_priv(indio_dev);
int value;
if (chip->channel_id > AD7816_CS_MAX) {
const char *buf,
size_t len)
{
- struct iio_dev *dev_info = dev_get_drvdata(dev);
- struct ad7816_chip_info *chip = iio_priv(dev_info);
+ struct iio_dev *indio_dev = dev_get_drvdata(dev);
+ struct ad7816_chip_info *chip = iio_priv(indio_dev);
long value;
u8 data;
int ret;
return (st->data[(ch * 2)] << 8) | st->data[(ch * 2) + 1];
}
-static int ad7887_read_raw(struct iio_dev *dev_info,
+static int ad7887_read_raw(struct iio_dev *indio_dev,
struct iio_chan_spec const *chan,
int *val,
int *val2,
long m)
{
int ret;
- struct ad7887_state *st = iio_priv(dev_info);
+ struct ad7887_state *st = iio_priv(indio_dev);
unsigned int scale_uv;
switch (m) {
case 0:
- mutex_lock(&dev_info->mlock);
- if (iio_buffer_enabled(dev_info))
+ mutex_lock(&indio_dev->mlock);
+ if (iio_buffer_enabled(indio_dev))
ret = ad7887_scan_from_ring(st, 1 << chan->address);
else
ret = ad7887_scan_direct(st, chan->address);
- mutex_unlock(&dev_info->mlock);
+ mutex_unlock(&indio_dev->mlock);
if (ret < 0)
return ret;
return rxbuf;
}
-static int ad799x_read_raw(struct iio_dev *dev_info,
+static int ad799x_read_raw(struct iio_dev *indio_dev,
struct iio_chan_spec const *chan,
int *val,
int *val2,
long m)
{
int ret;
- struct ad799x_state *st = iio_priv(dev_info);
+ struct ad799x_state *st = iio_priv(indio_dev);
unsigned int scale_uv;
switch (m) {
case 0:
- mutex_lock(&dev_info->mlock);
- if (iio_buffer_enabled(dev_info))
- ret = ad799x_single_channel_from_ring(dev_info,
+ mutex_lock(&indio_dev->mlock);
+ if (iio_buffer_enabled(indio_dev))
+ ret = ad799x_single_channel_from_ring(indio_dev,
chan->scan_index);
else
ret = ad799x_scan_direct(st, chan->scan_index);
- mutex_unlock(&dev_info->mlock);
+ mutex_unlock(&indio_dev->mlock);
if (ret < 0)
return ret;
struct device_attribute *attr,
char *buf)
{
- struct iio_dev *dev_info = dev_get_drvdata(dev);
- struct ad799x_state *st = iio_priv(dev_info);
+ struct iio_dev *indio_dev = dev_get_drvdata(dev);
+ struct ad799x_state *st = iio_priv(indio_dev);
int ret;
u8 val;
const char *buf,
size_t len)
{
- struct iio_dev *dev_info = dev_get_drvdata(dev);
- struct ad799x_state *st = iio_priv(dev_info);
+ struct iio_dev *indio_dev = dev_get_drvdata(dev);
+ struct ad799x_state *st = iio_priv(indio_dev);
long val;
int ret, i;
if (ret)
return ret;
- mutex_lock(&dev_info->mlock);
+ mutex_lock(&indio_dev->mlock);
ret = ad799x_i2c_read8(st, AD7998_CYCLE_TMR_REG, &t);
if (ret)
goto error_ret_mutex;
ret = ad799x_i2c_write8(st, AD7998_CYCLE_TMR_REG, t);
error_ret_mutex:
- mutex_unlock(&dev_info->mlock);
+ mutex_unlock(&indio_dev->mlock);
return ret ? ret : len;
}
-static int ad799x_read_event_config(struct iio_dev *dev_info,
+static int ad799x_read_event_config(struct iio_dev *indio_dev,
u64 event_code)
{
return 1;
struct device_attribute *attr,
char *buf)
{
- struct iio_dev *dev_info = dev_get_drvdata(dev);
- struct ad799x_state *st = iio_priv(dev_info);
+ struct iio_dev *indio_dev = dev_get_drvdata(dev);
+ struct ad799x_state *st = iio_priv(indio_dev);
struct iio_dev_attr *this_attr = to_iio_dev_attr(attr);
int ret;
const char *buf,
size_t len)
{
- struct iio_dev *dev_info = dev_get_drvdata(dev);
- struct ad799x_state *st = iio_priv(dev_info);
+ struct iio_dev *indio_dev = dev_get_drvdata(dev);
+ struct ad799x_state *st = iio_priv(indio_dev);
struct iio_dev_attr *this_attr = to_iio_dev_attr(attr);
long val;
if (ret)
return ret;
- mutex_lock(&dev_info->mlock);
+ mutex_lock(&indio_dev->mlock);
ret = ad799x_i2c_write16(st, this_attr->address, val);
- mutex_unlock(&dev_info->mlock);
+ mutex_unlock(&indio_dev->mlock);
return ret ? ret : len;
}