staging:iio: implement an iio_info structure to take some of the constant elements out of iio_dev.
This was suggested by Arnd Bergmann, Other elements may well move in here in future, but it definitely makes sense for these. Signed-off-by: Jonathan Cameron <jic23@cam.ac.uk> Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
This commit is contained in:
parent
a3f02370c9
commit
6fe8135fcc
|
@ -457,6 +457,13 @@ static const struct attribute_group adis16201_attribute_group = {
|
|||
.attrs = adis16201_attributes,
|
||||
};
|
||||
|
||||
static const struct iio_info adis16201_info = {
|
||||
.attrs = &adis16201_attribute_group,
|
||||
.read_raw = &adis16201_read_raw,
|
||||
.write_raw = &adis16201_write_raw,
|
||||
.driver_module = THIS_MODULE,
|
||||
};
|
||||
|
||||
static int __devinit adis16201_probe(struct spi_device *spi)
|
||||
{
|
||||
int ret, regdone = 0;
|
||||
|
@ -490,13 +497,11 @@ static int __devinit adis16201_probe(struct spi_device *spi)
|
|||
|
||||
st->indio_dev->name = spi->dev.driver->name;
|
||||
st->indio_dev->dev.parent = &spi->dev;
|
||||
st->indio_dev->attrs = &adis16201_attribute_group;
|
||||
st->indio_dev->info = &adis16201_info;
|
||||
|
||||
st->indio_dev->channels = adis16201_channels;
|
||||
st->indio_dev->num_channels = ARRAY_SIZE(adis16201_channels);
|
||||
st->indio_dev->read_raw = &adis16201_read_raw;
|
||||
st->indio_dev->write_raw = &adis16201_write_raw;
|
||||
st->indio_dev->dev_data = (void *)(st);
|
||||
st->indio_dev->driver_module = THIS_MODULE;
|
||||
st->indio_dev->modes = INDIO_DIRECT_MODE;
|
||||
|
||||
ret = adis16201_configure_ring(st->indio_dev);
|
||||
|
|
|
@ -408,6 +408,13 @@ static const struct attribute_group adis16203_attribute_group = {
|
|||
.attrs = adis16203_attributes,
|
||||
};
|
||||
|
||||
static const struct iio_info adis16203_info = {
|
||||
.attrs = &adis16203_attribute_group,
|
||||
.read_raw = &adis16203_read_raw,
|
||||
.write_raw = &adis16203_write_raw,
|
||||
.driver_module = THIS_MODULE,
|
||||
};
|
||||
|
||||
static int __devinit adis16203_probe(struct spi_device *spi)
|
||||
{
|
||||
int ret, regdone = 0;
|
||||
|
@ -440,13 +447,10 @@ static int __devinit adis16203_probe(struct spi_device *spi)
|
|||
}
|
||||
st->indio_dev->name = spi->dev.driver->name;
|
||||
st->indio_dev->dev.parent = &spi->dev;
|
||||
st->indio_dev->attrs = &adis16203_attribute_group;
|
||||
st->indio_dev->channels = adis16203_channels;
|
||||
st->indio_dev->num_channels = ARRAY_SIZE(adis16203_channels);
|
||||
st->indio_dev->read_raw = &adis16203_read_raw;
|
||||
st->indio_dev->write_raw = &adis16203_write_raw;
|
||||
st->indio_dev->info = &adis16203_info;
|
||||
st->indio_dev->dev_data = (void *)(st);
|
||||
st->indio_dev->driver_module = THIS_MODULE;
|
||||
st->indio_dev->modes = INDIO_DIRECT_MODE;
|
||||
|
||||
ret = adis16203_configure_ring(st->indio_dev);
|
||||
|
|
|
@ -473,6 +473,13 @@ static const struct attribute_group adis16204_attribute_group = {
|
|||
.attrs = adis16204_attributes,
|
||||
};
|
||||
|
||||
static const struct iio_info adis16204_info = {
|
||||
.attrs = &adis16204_attribute_group,
|
||||
.read_raw = &adis16204_read_raw,
|
||||
.write_raw = &adis16204_write_raw,
|
||||
.driver_module = THIS_MODULE,
|
||||
};
|
||||
|
||||
static int __devinit adis16204_probe(struct spi_device *spi)
|
||||
{
|
||||
int ret, regdone = 0;
|
||||
|
@ -506,13 +513,10 @@ static int __devinit adis16204_probe(struct spi_device *spi)
|
|||
|
||||
st->indio_dev->name = spi->dev.driver->name;
|
||||
st->indio_dev->dev.parent = &spi->dev;
|
||||
st->indio_dev->attrs = &adis16204_attribute_group;
|
||||
st->indio_dev->info = &adis16204_info;
|
||||
st->indio_dev->channels = adis16204_channels;
|
||||
st->indio_dev->num_channels = ARRAY_SIZE(adis16204_channels);
|
||||
st->indio_dev->read_raw = &adis16204_read_raw;
|
||||
st->indio_dev->write_raw = &adis16204_write_raw;
|
||||
st->indio_dev->dev_data = (void *)(st);
|
||||
st->indio_dev->driver_module = THIS_MODULE;
|
||||
st->indio_dev->modes = INDIO_DIRECT_MODE;
|
||||
|
||||
ret = adis16204_configure_ring(st->indio_dev);
|
||||
|
|
|
@ -456,6 +456,13 @@ static const struct attribute_group adis16209_attribute_group = {
|
|||
.attrs = adis16209_attributes,
|
||||
};
|
||||
|
||||
static const struct iio_info adis16209_info = {
|
||||
.attrs = &adis16209_attribute_group,
|
||||
.read_raw = &adis16209_read_raw,
|
||||
.write_raw = &adis16209_write_raw,
|
||||
.driver_module = THIS_MODULE,
|
||||
};
|
||||
|
||||
static int __devinit adis16209_probe(struct spi_device *spi)
|
||||
{
|
||||
int ret, regdone = 0;
|
||||
|
@ -489,13 +496,10 @@ static int __devinit adis16209_probe(struct spi_device *spi)
|
|||
|
||||
st->indio_dev->name = spi->dev.driver->name;
|
||||
st->indio_dev->dev.parent = &spi->dev;
|
||||
st->indio_dev->attrs = &adis16209_attribute_group;
|
||||
st->indio_dev->info = &adis16209_info;
|
||||
st->indio_dev->channels = adis16209_channels;
|
||||
st->indio_dev->num_channels = ARRAY_SIZE(adis16209_channels);
|
||||
st->indio_dev->read_raw = &adis16209_read_raw;
|
||||
st->indio_dev->write_raw = &adis16209_write_raw;
|
||||
st->indio_dev->dev_data = (void *)(st);
|
||||
st->indio_dev->driver_module = THIS_MODULE;
|
||||
st->indio_dev->modes = INDIO_DIRECT_MODE;
|
||||
|
||||
ret = adis16209_configure_ring(st->indio_dev);
|
||||
|
|
|
@ -544,6 +544,10 @@ static const struct attribute_group adis16220_attribute_group = {
|
|||
.attrs = adis16220_attributes,
|
||||
};
|
||||
|
||||
static const struct iio_info adis16220_info = {
|
||||
.attrs = &adis16220_attribute_group,
|
||||
.driver_module = THIS_MODULE,
|
||||
};
|
||||
static int __devinit adis16220_probe(struct spi_device *spi)
|
||||
{
|
||||
int ret, regdone = 0;
|
||||
|
@ -577,9 +581,8 @@ static int __devinit adis16220_probe(struct spi_device *spi)
|
|||
|
||||
st->indio_dev->name = spi->dev.driver->name;
|
||||
st->indio_dev->dev.parent = &spi->dev;
|
||||
st->indio_dev->attrs = &adis16220_attribute_group;
|
||||
st->indio_dev->info = &adis16220_info;
|
||||
st->indio_dev->dev_data = (void *)(st);
|
||||
st->indio_dev->driver_module = THIS_MODULE;
|
||||
st->indio_dev->modes = INDIO_DIRECT_MODE;
|
||||
|
||||
ret = iio_device_register(st->indio_dev);
|
||||
|
|
|
@ -507,6 +507,13 @@ static const struct attribute_group adis16240_attribute_group = {
|
|||
.attrs = adis16240_attributes,
|
||||
};
|
||||
|
||||
static const struct iio_info adis16240_info = {
|
||||
.attrs = &adis16240_attribute_group,
|
||||
.read_raw = &adis16240_read_raw,
|
||||
.write_raw = &adis16240_write_raw,
|
||||
.driver_module = THIS_MODULE,
|
||||
};
|
||||
|
||||
static int __devinit adis16240_probe(struct spi_device *spi)
|
||||
{
|
||||
int ret, regdone = 0;
|
||||
|
@ -540,13 +547,10 @@ static int __devinit adis16240_probe(struct spi_device *spi)
|
|||
|
||||
st->indio_dev->name = spi->dev.driver->name;
|
||||
st->indio_dev->dev.parent = &spi->dev;
|
||||
st->indio_dev->attrs = &adis16240_attribute_group;
|
||||
st->indio_dev->info = &adis16240_info;
|
||||
st->indio_dev->channels = adis16240_channels;
|
||||
st->indio_dev->num_channels = ARRAY_SIZE(adis16240_channels);
|
||||
st->indio_dev->read_raw = &adis16240_read_raw;
|
||||
st->indio_dev->write_raw = &adis16240_write_raw;
|
||||
st->indio_dev->dev_data = (void *)(st);
|
||||
st->indio_dev->driver_module = THIS_MODULE;
|
||||
st->indio_dev->modes = INDIO_DIRECT_MODE;
|
||||
|
||||
ret = adis16240_configure_ring(st->indio_dev);
|
||||
|
|
|
@ -301,6 +301,11 @@ error_ret:
|
|||
|
||||
};
|
||||
|
||||
static const struct iio_info kxsd9_info = {
|
||||
.attrs = &kxsd9_attribute_group,
|
||||
.driver_module = THIS_MODULE,
|
||||
};
|
||||
|
||||
static int __devinit kxsd9_probe(struct spi_device *spi)
|
||||
{
|
||||
|
||||
|
@ -335,13 +340,8 @@ static int __devinit kxsd9_probe(struct spi_device *spi)
|
|||
goto error_free_tx;
|
||||
}
|
||||
st->indio_dev->dev.parent = &spi->dev;
|
||||
/* for now */
|
||||
st->indio_dev->num_interrupt_lines = 0;
|
||||
st->indio_dev->event_attrs = NULL;
|
||||
|
||||
st->indio_dev->attrs = &kxsd9_attribute_group;
|
||||
st->indio_dev->info = &kxsd9_info;
|
||||
st->indio_dev->dev_data = (void *)(st);
|
||||
st->indio_dev->driver_module = THIS_MODULE;
|
||||
st->indio_dev->modes = INDIO_DIRECT_MODE;
|
||||
|
||||
ret = iio_device_register(st->indio_dev);
|
||||
|
|
|
@ -651,6 +651,18 @@ static const struct attribute_group lis3l02dq_attribute_group = {
|
|||
.attrs = lis3l02dq_attributes,
|
||||
};
|
||||
|
||||
static const struct iio_info lis3l02dq_info = {
|
||||
.num_interrupt_lines = 1,
|
||||
.read_raw = &lis3l02dq_read_raw,
|
||||
.write_raw = &lis3l02dq_write_raw,
|
||||
.read_event_value = &lis3l02dq_read_thresh,
|
||||
.write_event_value = &lis3l02dq_write_thresh,
|
||||
.write_event_config = &lis3l02dq_write_event_config,
|
||||
.read_event_config = &lis3l02dq_read_event_config,
|
||||
.driver_module = THIS_MODULE,
|
||||
.attrs = &lis3l02dq_attribute_group,
|
||||
};
|
||||
|
||||
static int __devinit lis3l02dq_probe(struct spi_device *spi)
|
||||
{
|
||||
int ret, regdone = 0;
|
||||
|
@ -670,17 +682,10 @@ static int __devinit lis3l02dq_probe(struct spi_device *spi)
|
|||
mutex_init(&st->buf_lock);
|
||||
indio_dev->name = spi->dev.driver->name;
|
||||
indio_dev->dev.parent = &spi->dev;
|
||||
indio_dev->num_interrupt_lines = 1;
|
||||
indio_dev->info = &lis3l02dq_info;
|
||||
indio_dev->channels = lis3l02dq_channels;
|
||||
indio_dev->num_channels = ARRAY_SIZE(lis3l02dq_channels);
|
||||
indio_dev->read_raw = &lis3l02dq_read_raw;
|
||||
indio_dev->write_raw = &lis3l02dq_write_raw;
|
||||
indio_dev->read_event_value = &lis3l02dq_read_thresh;
|
||||
indio_dev->write_event_value = &lis3l02dq_write_thresh;
|
||||
indio_dev->write_event_config = &lis3l02dq_write_event_config;
|
||||
indio_dev->read_event_config = &lis3l02dq_read_event_config;
|
||||
indio_dev->attrs = &lis3l02dq_attribute_group;
|
||||
indio_dev->driver_module = THIS_MODULE;
|
||||
|
||||
indio_dev->modes = INDIO_DIRECT_MODE;
|
||||
|
||||
ret = lis3l02dq_configure_ring(indio_dev);
|
||||
|
|
|
@ -1100,6 +1100,28 @@ error_ret:
|
|||
return ret;
|
||||
}
|
||||
|
||||
static const struct iio_info sca3000_info = {
|
||||
.attrs = &sca3000_attribute_group,
|
||||
.read_raw = &sca3000_read_raw,
|
||||
.num_interrupt_lines = 1,
|
||||
.event_attrs = &sca3000_event_attribute_group,
|
||||
.read_event_value = &sca3000_read_thresh,
|
||||
.write_event_value = &sca3000_write_thresh,
|
||||
.read_event_config = &sca3000_read_event_config,
|
||||
.write_event_config = &sca3000_write_event_config,
|
||||
.driver_module = THIS_MODULE,
|
||||
};
|
||||
|
||||
static const struct iio_info sca3000_info_with_temp = {
|
||||
.attrs = &sca3000_attribute_group_with_temp,
|
||||
.read_raw = &sca3000_read_raw,
|
||||
.read_event_value = &sca3000_read_thresh,
|
||||
.write_event_value = &sca3000_write_thresh,
|
||||
.read_event_config = &sca3000_read_event_config,
|
||||
.write_event_config = &sca3000_write_event_config,
|
||||
.driver_module = THIS_MODULE,
|
||||
};
|
||||
|
||||
static int __devinit sca3000_probe(struct spi_device *spi)
|
||||
{
|
||||
int ret, regdone = 0;
|
||||
|
@ -1124,20 +1146,13 @@ static int __devinit sca3000_probe(struct spi_device *spi)
|
|||
}
|
||||
st->indio_dev->dev.parent = &spi->dev;
|
||||
st->indio_dev->name = spi_get_device_id(spi)->name;
|
||||
st->indio_dev->num_interrupt_lines = 1;
|
||||
st->indio_dev->event_attrs = &sca3000_event_attribute_group;
|
||||
if (st->info->temp_output)
|
||||
st->indio_dev->attrs = &sca3000_attribute_group_with_temp;
|
||||
st->indio_dev->info = &sca3000_info_with_temp;
|
||||
else {
|
||||
st->indio_dev->attrs = &sca3000_attribute_group;
|
||||
st->indio_dev->info = &sca3000_info;
|
||||
st->indio_dev->channels = sca3000_channels;
|
||||
st->indio_dev->num_channels = ARRAY_SIZE(sca3000_channels);
|
||||
}
|
||||
st->indio_dev->read_raw = &sca3000_read_raw;
|
||||
st->indio_dev->read_event_value = &sca3000_read_thresh;
|
||||
st->indio_dev->write_event_value = &sca3000_write_thresh;
|
||||
st->indio_dev->read_event_config = &sca3000_read_event_config;
|
||||
st->indio_dev->write_event_config = &sca3000_write_event_config;
|
||||
st->indio_dev->dev_data = (void *)(st);
|
||||
st->indio_dev->modes = INDIO_DIRECT_MODE;
|
||||
|
||||
|
|
|
@ -700,6 +700,12 @@ static struct attribute_group ad7150_event_attribute_group = {
|
|||
.attrs = ad7150_event_attributes,
|
||||
};
|
||||
|
||||
static const struct iio_info ad7150_info = {
|
||||
.attrs = &ad7150_attribute_group,
|
||||
.num_interrupt_lines = 1,
|
||||
.event_attrs = &ad7150_event_attribute_group,
|
||||
.driver_module = THIS_MODULE,
|
||||
};
|
||||
/*
|
||||
* device probe and remove
|
||||
*/
|
||||
|
@ -725,14 +731,13 @@ static int __devinit ad7150_probe(struct i2c_client *client,
|
|||
goto error_free_chip;
|
||||
}
|
||||
|
||||
/* Echipabilish that the iio_dev is a child of the i2c device */
|
||||
/* Establish that the iio_dev is a child of the i2c device */
|
||||
chip->indio_dev->name = id->name;
|
||||
chip->indio_dev->dev.parent = &client->dev;
|
||||
chip->indio_dev->attrs = &ad7150_attribute_group;
|
||||
chip->indio_dev->event_attrs = &ad7150_event_attribute_group;
|
||||
|
||||
chip->indio_dev->info = &ad7150_info;
|
||||
chip->indio_dev->dev_data = (void *)(chip);
|
||||
chip->indio_dev->driver_module = THIS_MODULE;
|
||||
chip->indio_dev->num_interrupt_lines = 1;
|
||||
|
||||
chip->indio_dev->modes = INDIO_DIRECT_MODE;
|
||||
|
||||
ret = iio_device_register(chip->indio_dev);
|
||||
|
|
|
@ -497,6 +497,10 @@ static const struct attribute_group ad7152_attribute_group = {
|
|||
.attrs = ad7152_attributes,
|
||||
};
|
||||
|
||||
static const struct iio_info ad7152_info = {
|
||||
.attrs = &ad7152_attribute_group,
|
||||
.driver_module = THIS_MODULE,
|
||||
};
|
||||
/*
|
||||
* device probe and remove
|
||||
*/
|
||||
|
@ -525,9 +529,8 @@ static int __devinit ad7152_probe(struct i2c_client *client,
|
|||
/* Echipabilish that the iio_dev is a child of the i2c device */
|
||||
chip->indio_dev->name = id->name;
|
||||
chip->indio_dev->dev.parent = &client->dev;
|
||||
chip->indio_dev->attrs = &ad7152_attribute_group;
|
||||
chip->indio_dev->info = &ad7152_info;
|
||||
chip->indio_dev->dev_data = (void *)(chip);
|
||||
chip->indio_dev->driver_module = THIS_MODULE;
|
||||
chip->indio_dev->modes = INDIO_DIRECT_MODE;
|
||||
|
||||
ret = iio_device_register(chip->indio_dev);
|
||||
|
|
|
@ -778,6 +778,12 @@ static struct attribute_group ad7291_event_attribute_group = {
|
|||
.attrs = ad7291_event_attributes,
|
||||
};
|
||||
|
||||
static const struct iio_info ad7291_info = {
|
||||
.attrs = &ad7291_attribute_group,
|
||||
.num_interrupt_lines = 1,
|
||||
.event_attrs = &ad7291_event_attribute_group,
|
||||
};
|
||||
|
||||
/*
|
||||
* device probe and remove
|
||||
*/
|
||||
|
@ -807,11 +813,8 @@ static int __devinit ad7291_probe(struct i2c_client *client,
|
|||
|
||||
chip->indio_dev->name = id->name;
|
||||
chip->indio_dev->dev.parent = &client->dev;
|
||||
chip->indio_dev->attrs = &ad7291_attribute_group;
|
||||
chip->indio_dev->event_attrs = &ad7291_event_attribute_group;
|
||||
chip->indio_dev->info = &ad7291_info;
|
||||
chip->indio_dev->dev_data = (void *)chip;
|
||||
chip->indio_dev->driver_module = THIS_MODULE;
|
||||
chip->indio_dev->num_interrupt_lines = 1;
|
||||
chip->indio_dev->modes = INDIO_DIRECT_MODE;
|
||||
|
||||
ret = iio_device_register(chip->indio_dev);
|
||||
|
|
|
@ -156,6 +156,11 @@ static int ad7298_read_raw(struct iio_dev *dev_info,
|
|||
return -EINVAL;
|
||||
}
|
||||
|
||||
static const struct iio_info ad7298_info = {
|
||||
.read_raw = &ad7298_read_raw,
|
||||
.driver_module = THIS_MODULE,
|
||||
};
|
||||
|
||||
static int __devinit ad7298_probe(struct spi_device *spi)
|
||||
{
|
||||
struct ad7298_platform_data *pdata = spi->dev.platform_data;
|
||||
|
@ -181,11 +186,10 @@ static int __devinit ad7298_probe(struct spi_device *spi)
|
|||
|
||||
indio_dev->name = spi_get_device_id(spi)->name;
|
||||
indio_dev->dev.parent = &spi->dev;
|
||||
indio_dev->driver_module = THIS_MODULE;
|
||||
indio_dev->modes = INDIO_DIRECT_MODE;
|
||||
indio_dev->channels = ad7298_channels;
|
||||
indio_dev->num_channels = ARRAY_SIZE(ad7298_channels);
|
||||
indio_dev->read_raw = &ad7298_read_raw;
|
||||
indio_dev->info = &ad7298_info;
|
||||
|
||||
/* Setup default message */
|
||||
|
||||
|
|
|
@ -191,6 +191,10 @@ static const struct attribute_group ad7314_attribute_group = {
|
|||
.attrs = ad7314_attributes,
|
||||
};
|
||||
|
||||
static const struct iio_info ad7314_info = {
|
||||
.attrs = &ad7314_attribute_group,
|
||||
.driver_module = THIS_MODULE,
|
||||
};
|
||||
/*
|
||||
* device probe and remove
|
||||
*/
|
||||
|
@ -218,9 +222,8 @@ static int __devinit ad7314_probe(struct spi_device *spi_dev)
|
|||
|
||||
chip->indio_dev->name = spi_get_device_id(spi_dev)->name;
|
||||
chip->indio_dev->dev.parent = &spi_dev->dev;
|
||||
chip->indio_dev->attrs = &ad7314_attribute_group;
|
||||
chip->indio_dev->info = &ad7314_info;
|
||||
chip->indio_dev->dev_data = (void *)chip;
|
||||
chip->indio_dev->driver_module = THIS_MODULE;
|
||||
|
||||
ret = iio_device_register(chip->indio_dev);
|
||||
if (ret)
|
||||
|
|
|
@ -118,6 +118,11 @@ static const struct ad7476_chip_info ad7476_chip_info_tbl[] = {
|
|||
},
|
||||
};
|
||||
|
||||
static const struct iio_info ad7476_info = {
|
||||
.driver_module = THIS_MODULE,
|
||||
.read_raw = &ad7476_read_raw,
|
||||
};
|
||||
|
||||
static int __devinit ad7476_probe(struct spi_device *spi)
|
||||
{
|
||||
struct ad7476_platform_data *pdata = spi->dev.platform_data;
|
||||
|
@ -165,11 +170,10 @@ static int __devinit ad7476_probe(struct spi_device *spi)
|
|||
st->indio_dev->dev.parent = &spi->dev;
|
||||
st->indio_dev->name = spi_get_device_id(spi)->name;
|
||||
st->indio_dev->dev_data = (void *)(st);
|
||||
st->indio_dev->driver_module = THIS_MODULE;
|
||||
st->indio_dev->modes = INDIO_DIRECT_MODE;
|
||||
st->indio_dev->channels = st->chip_info->channel;
|
||||
st->indio_dev->num_channels = 2;
|
||||
st->indio_dev->read_raw = &ad7476_read_raw;
|
||||
st->indio_dev->info = &ad7476_info;
|
||||
/* Setup default message */
|
||||
|
||||
st->xfer.rx_buf = &st->data;
|
||||
|
|
|
@ -426,6 +426,12 @@ static irqreturn_t ad7606_interrupt(int irq, void *dev_id)
|
|||
return IRQ_HANDLED;
|
||||
};
|
||||
|
||||
static const struct iio_info ad7606_info = {
|
||||
.driver_module = THIS_MODULE,
|
||||
.read_raw = &ad7606_read_raw,
|
||||
.attrs = &ad7606_attribute_group,
|
||||
};
|
||||
|
||||
struct iio_dev *ad7606_probe(struct device *dev, int irq,
|
||||
void __iomem *base_address,
|
||||
unsigned id,
|
||||
|
@ -470,13 +476,11 @@ struct iio_dev *ad7606_probe(struct device *dev, int irq,
|
|||
st->chip_info = &ad7606_chip_info_tbl[id];
|
||||
|
||||
indio_dev->dev.parent = dev;
|
||||
indio_dev->attrs = &ad7606_attribute_group;
|
||||
indio_dev->driver_module = THIS_MODULE;
|
||||
indio_dev->info = &ad7606_info;
|
||||
indio_dev->modes = INDIO_DIRECT_MODE;
|
||||
indio_dev->name = st->chip_info->name;
|
||||
indio_dev->channels = st->chip_info->channels;
|
||||
indio_dev->num_channels = st->chip_info->num_channels;
|
||||
indio_dev->read_raw = &ad7606_read_raw;
|
||||
|
||||
init_waitqueue_head(&st->wq_data_avail);
|
||||
|
||||
|
|
|
@ -565,6 +565,12 @@ static struct attribute_group ad774x_event_attribute_group = {
|
|||
.attrs = ad774x_event_attributes,
|
||||
};
|
||||
|
||||
static const struct iio_info ad774x_info = {
|
||||
.attrs = &ad774x_event_attribute_group,
|
||||
.event_attrs = &ad774x_event_attribute_group,
|
||||
.num_interrupt_lines = 1,
|
||||
.driver_module = THIS_MODULE,
|
||||
};
|
||||
/*
|
||||
* device probe and remove
|
||||
*/
|
||||
|
@ -593,11 +599,8 @@ static int __devinit ad774x_probe(struct i2c_client *client,
|
|||
/* Establish that the iio_dev is a child of the i2c device */
|
||||
chip->indio_dev->name = id->name;
|
||||
chip->indio_dev->dev.parent = &client->dev;
|
||||
chip->indio_dev->attrs = &ad774x_attribute_group;
|
||||
chip->indio_dev->event_attrs = &ad774x_event_attribute_group;
|
||||
chip->indio_dev->info = &ad774x_info;
|
||||
chip->indio_dev->dev_data = (void *)(chip);
|
||||
chip->indio_dev->driver_module = THIS_MODULE;
|
||||
chip->indio_dev->num_interrupt_lines = 1;
|
||||
chip->indio_dev->modes = INDIO_DIRECT_MODE;
|
||||
|
||||
ret = iio_device_register(chip->indio_dev);
|
||||
|
|
|
@ -151,6 +151,11 @@ static irqreturn_t ad7780_interrupt(int irq, void *dev_id)
|
|||
return IRQ_HANDLED;
|
||||
};
|
||||
|
||||
static const struct iio_info ad7780_info = {
|
||||
.read_raw = &ad7780_read_raw,
|
||||
.driver_module = THIS_MODULE,
|
||||
};
|
||||
|
||||
static int __devinit ad7780_probe(struct spi_device *spi)
|
||||
{
|
||||
struct ad7780_platform_data *pdata = spi->dev.platform_data;
|
||||
|
@ -195,11 +200,10 @@ static int __devinit ad7780_probe(struct spi_device *spi)
|
|||
|
||||
indio_dev->dev.parent = &spi->dev;
|
||||
indio_dev->name = spi_get_device_id(spi)->name;
|
||||
indio_dev->driver_module = THIS_MODULE;
|
||||
indio_dev->modes = INDIO_DIRECT_MODE;
|
||||
indio_dev->channels = &st->chip_info->channel;
|
||||
indio_dev->num_channels = 1;
|
||||
indio_dev->read_raw = &ad7780_read_raw;
|
||||
indio_dev->info = &ad7780_info;
|
||||
|
||||
init_waitqueue_head(&st->wq_data_avail);
|
||||
|
||||
|
|
|
@ -331,6 +331,13 @@ static struct attribute_group ad7816_event_attribute_group = {
|
|||
.attrs = ad7816_event_attributes,
|
||||
};
|
||||
|
||||
static const struct iio_info ad7816_info = {
|
||||
.attrs = &ad7816_attribute_group,
|
||||
.num_interrupt_lines = 1,
|
||||
.event_attrs = &ad7816_event_attribute_group,
|
||||
.driver_module = THIS_MODULE,
|
||||
};
|
||||
|
||||
/*
|
||||
* device probe and remove
|
||||
*/
|
||||
|
@ -391,11 +398,8 @@ static int __devinit ad7816_probe(struct spi_device *spi_dev)
|
|||
}
|
||||
chip->indio_dev->name = spi_get_device_id(spi_dev)->name;
|
||||
chip->indio_dev->dev.parent = &spi_dev->dev;
|
||||
chip->indio_dev->attrs = &ad7816_attribute_group;
|
||||
chip->indio_dev->event_attrs = &ad7816_event_attribute_group;
|
||||
chip->indio_dev->info = &ad7816_info;
|
||||
chip->indio_dev->dev_data = (void *)chip;
|
||||
chip->indio_dev->driver_module = THIS_MODULE;
|
||||
chip->indio_dev->num_interrupt_lines = 1;
|
||||
chip->indio_dev->modes = INDIO_DIRECT_MODE;
|
||||
|
||||
ret = iio_device_register(chip->indio_dev);
|
||||
|
|
|
@ -83,6 +83,11 @@ static const struct ad7887_chip_info ad7887_chip_info_tbl[] = {
|
|||
},
|
||||
};
|
||||
|
||||
static const struct iio_info ad7887_info = {
|
||||
.read_raw = &ad7887_read_raw,
|
||||
.driver_module = THIS_MODULE,
|
||||
};
|
||||
|
||||
static int __devinit ad7887_probe(struct spi_device *spi)
|
||||
{
|
||||
struct ad7887_platform_data *pdata = spi->dev.platform_data;
|
||||
|
@ -114,8 +119,7 @@ static int __devinit ad7887_probe(struct spi_device *spi)
|
|||
indio_dev->dev.parent = &spi->dev;
|
||||
indio_dev->name = spi_get_device_id(spi)->name;
|
||||
indio_dev->dev_data = (void *)(st);
|
||||
indio_dev->read_raw = &ad7887_read_raw;
|
||||
indio_dev->driver_module = THIS_MODULE;
|
||||
indio_dev->info = &ad7887_info;
|
||||
indio_dev->modes = INDIO_DIRECT_MODE;
|
||||
|
||||
/* Setup default message */
|
||||
|
|
|
@ -97,9 +97,8 @@ struct ad799x_chip_info {
|
|||
struct iio_chan_spec channel[9];
|
||||
int num_channels;
|
||||
u16 int_vref_mv;
|
||||
bool monitor_mode;
|
||||
u16 default_config;
|
||||
struct attribute_group *event_attrs;
|
||||
const struct iio_info *info;
|
||||
};
|
||||
|
||||
struct ad799x_state {
|
||||
|
|
|
@ -459,6 +459,25 @@ static struct attribute_group ad7992_event_attrs_group = {
|
|||
.attrs = ad7992_event_attributes,
|
||||
};
|
||||
|
||||
static const struct iio_info ad7991_info = {
|
||||
.read_raw = &ad799x_read_raw,
|
||||
.driver_module = THIS_MODULE,
|
||||
};
|
||||
|
||||
static const struct iio_info ad7992_info = {
|
||||
.read_raw = &ad799x_read_raw,
|
||||
.num_interrupt_lines = 1,
|
||||
.event_attrs = &ad7992_event_attrs_group,
|
||||
.driver_module = THIS_MODULE,
|
||||
};
|
||||
|
||||
static const struct iio_info ad7993_4_7_8_info = {
|
||||
.read_raw = &ad799x_read_raw,
|
||||
.num_interrupt_lines = 1,
|
||||
.event_attrs = &ad7993_4_7_8_event_attrs_group,
|
||||
.driver_module = THIS_MODULE,
|
||||
};
|
||||
|
||||
static const struct ad799x_chip_info ad799x_chip_info_tbl[] = {
|
||||
[ad7991] = {
|
||||
.channel[0] = IIO_CHAN(IIO_IN, 0, 1, 0, NULL, 0, 0,
|
||||
|
@ -476,6 +495,7 @@ static const struct ad799x_chip_info ad799x_chip_info_tbl[] = {
|
|||
.channel[4] = IIO_CHAN_SOFT_TIMESTAMP(4),
|
||||
.num_channels = 5,
|
||||
.int_vref_mv = 4096,
|
||||
.info = &ad7991_info,
|
||||
},
|
||||
[ad7995] = {
|
||||
.channel[0] = IIO_CHAN(IIO_IN, 0, 1, 0, NULL, 0, 0,
|
||||
|
@ -493,6 +513,7 @@ static const struct ad799x_chip_info ad799x_chip_info_tbl[] = {
|
|||
.channel[4] = IIO_CHAN_SOFT_TIMESTAMP(4),
|
||||
.num_channels = 5,
|
||||
.int_vref_mv = 1024,
|
||||
.info = &ad7991_info,
|
||||
},
|
||||
[ad7999] = {
|
||||
.channel[0] = IIO_CHAN(IIO_IN, 0, 1, 0, NULL, 0, 0,
|
||||
|
@ -510,6 +531,7 @@ static const struct ad799x_chip_info ad799x_chip_info_tbl[] = {
|
|||
.channel[4] = IIO_CHAN_SOFT_TIMESTAMP(4),
|
||||
.num_channels = 5,
|
||||
.int_vref_mv = 1024,
|
||||
.info = &ad7991_info,
|
||||
},
|
||||
[ad7992] = {
|
||||
.channel[0] = IIO_CHAN(IIO_IN, 0, 1, 0, NULL, 0, 0,
|
||||
|
@ -521,9 +543,8 @@ static const struct ad799x_chip_info ad799x_chip_info_tbl[] = {
|
|||
.channel[2] = IIO_CHAN_SOFT_TIMESTAMP(2),
|
||||
.num_channels = 3,
|
||||
.int_vref_mv = 4096,
|
||||
.monitor_mode = true,
|
||||
.default_config = AD7998_ALERT_EN,
|
||||
.event_attrs = &ad7992_event_attrs_group,
|
||||
.info = &ad7992_info,
|
||||
},
|
||||
[ad7993] = {
|
||||
.channel[0] = IIO_CHAN(IIO_IN, 0, 1, 0, NULL, 0, 0,
|
||||
|
@ -541,9 +562,8 @@ static const struct ad799x_chip_info ad799x_chip_info_tbl[] = {
|
|||
.channel[4] = IIO_CHAN_SOFT_TIMESTAMP(4),
|
||||
.num_channels = 5,
|
||||
.int_vref_mv = 1024,
|
||||
.monitor_mode = true,
|
||||
.default_config = AD7998_ALERT_EN,
|
||||
.event_attrs = &ad7993_4_7_8_event_attrs_group,
|
||||
.info = &ad7993_4_7_8_info,
|
||||
},
|
||||
[ad7994] = {
|
||||
.channel[0] = IIO_CHAN(IIO_IN, 0, 1, 0, NULL, 0, 0,
|
||||
|
@ -561,9 +581,8 @@ static const struct ad799x_chip_info ad799x_chip_info_tbl[] = {
|
|||
.channel[4] = IIO_CHAN_SOFT_TIMESTAMP(4),
|
||||
.num_channels = 5,
|
||||
.int_vref_mv = 4096,
|
||||
.monitor_mode = true,
|
||||
.default_config = AD7998_ALERT_EN,
|
||||
.event_attrs = &ad7993_4_7_8_event_attrs_group,
|
||||
.info = &ad7993_4_7_8_info,
|
||||
},
|
||||
[ad7997] = {
|
||||
.channel[0] = IIO_CHAN(IIO_IN, 0, 1, 0, NULL, 0, 0,
|
||||
|
@ -593,9 +612,8 @@ static const struct ad799x_chip_info ad799x_chip_info_tbl[] = {
|
|||
.channel[8] = IIO_CHAN_SOFT_TIMESTAMP(8),
|
||||
.num_channels = 9,
|
||||
.int_vref_mv = 1024,
|
||||
.monitor_mode = true,
|
||||
.default_config = AD7998_ALERT_EN,
|
||||
.event_attrs = &ad7993_4_7_8_event_attrs_group,
|
||||
.info = &ad7993_4_7_8_info,
|
||||
},
|
||||
[ad7998] = {
|
||||
.channel[0] = IIO_CHAN(IIO_IN, 0, 1, 0, NULL, 0, 0,
|
||||
|
@ -625,9 +643,8 @@ static const struct ad799x_chip_info ad799x_chip_info_tbl[] = {
|
|||
.channel[8] = IIO_CHAN_SOFT_TIMESTAMP(8),
|
||||
.num_channels = 9,
|
||||
.int_vref_mv = 4096,
|
||||
.monitor_mode = true,
|
||||
.default_config = AD7998_ALERT_EN,
|
||||
.event_attrs = &ad7993_4_7_8_event_attrs_group,
|
||||
.info = &ad7993_4_7_8_info,
|
||||
},
|
||||
};
|
||||
|
||||
|
@ -667,15 +684,13 @@ static int __devinit ad799x_probe(struct i2c_client *client,
|
|||
|
||||
indio_dev->dev.parent = &client->dev;
|
||||
indio_dev->name = id->name;
|
||||
indio_dev->event_attrs = st->chip_info->event_attrs;
|
||||
indio_dev->info = st->chip_info->info;
|
||||
indio_dev->name = id->name;
|
||||
indio_dev->dev_data = (void *)(st);
|
||||
indio_dev->driver_module = THIS_MODULE;
|
||||
|
||||
indio_dev->modes = INDIO_DIRECT_MODE;
|
||||
indio_dev->num_interrupt_lines = 1;
|
||||
indio_dev->channels = st->chip_info->channel;
|
||||
indio_dev->num_channels = st->chip_info->num_channels;
|
||||
indio_dev->read_raw = &ad799x_read_raw;
|
||||
|
||||
ret = ad799x_register_ring_funcs_and_init(indio_dev);
|
||||
if (ret)
|
||||
|
@ -692,7 +707,7 @@ static int __devinit ad799x_probe(struct i2c_client *client,
|
|||
if (ret)
|
||||
goto error_cleanup_ring;
|
||||
|
||||
if (client->irq > 0 && st->chip_info->monitor_mode) {
|
||||
if (client->irq > 0) {
|
||||
ret = request_threaded_irq(client->irq,
|
||||
NULL,
|
||||
ad799x_event_handler,
|
||||
|
@ -727,7 +742,7 @@ static __devexit int ad799x_remove(struct i2c_client *client)
|
|||
struct iio_dev *indio_dev = i2c_get_clientdata(client);
|
||||
struct ad799x_state *st = iio_priv(indio_dev);
|
||||
|
||||
if (client->irq > 0 && st->chip_info->monitor_mode)
|
||||
if (client->irq > 0)
|
||||
free_irq(client->irq, indio_dev);
|
||||
|
||||
iio_ring_buffer_unregister(indio_dev->ring);
|
||||
|
|
|
@ -746,6 +746,13 @@ static struct attribute_group adt7310_event_attribute_group[ADT7310_IRQS] = {
|
|||
}
|
||||
};
|
||||
|
||||
static const struct iio_info adt7310_info = {
|
||||
.attrs = &adt7310_attribute_group,
|
||||
.num_interrupt_lines = ADT7310_IRQS,
|
||||
.event_attrs = adt7310_event_attribute_group,
|
||||
.driver_module = THIS_MODULE,
|
||||
};
|
||||
|
||||
/*
|
||||
* device probe and remove
|
||||
*/
|
||||
|
@ -775,11 +782,8 @@ static int __devinit adt7310_probe(struct spi_device *spi_dev)
|
|||
|
||||
chip->indio_dev->dev.parent = &spi_dev->dev;
|
||||
chip->indio_dev->name = spi_get_device_id(spi_dev)->name;
|
||||
chip->indio_dev->attrs = &adt7310_attribute_group;
|
||||
chip->indio_dev->event_attrs = adt7310_event_attribute_group;
|
||||
chip->indio_dev->info = &adt7310_info;
|
||||
chip->indio_dev->dev_data = (void *)chip;
|
||||
chip->indio_dev->driver_module = THIS_MODULE;
|
||||
chip->indio_dev->num_interrupt_lines = ADT7310_IRQS;
|
||||
chip->indio_dev->modes = INDIO_DIRECT_MODE;
|
||||
|
||||
ret = iio_device_register(chip->indio_dev);
|
||||
|
|
|
@ -713,6 +713,13 @@ static struct attribute_group adt7410_event_attribute_group[ADT7410_IRQS] = {
|
|||
}
|
||||
};
|
||||
|
||||
static const struct iio_info adt7410_info = {
|
||||
.attrs = &adt7410_attribute_group,
|
||||
.num_interrupt_lines = ADT7410_IRQS,
|
||||
.event_attrs = adt7410_event_attribute_group,
|
||||
.driver_module = THIS_MODULE,
|
||||
};
|
||||
|
||||
/*
|
||||
* device probe and remove
|
||||
*/
|
||||
|
@ -741,11 +748,8 @@ static int __devinit adt7410_probe(struct i2c_client *client,
|
|||
}
|
||||
chip->indio_dev->name = id->name;
|
||||
chip->indio_dev->dev.parent = &client->dev;
|
||||
chip->indio_dev->attrs = &adt7410_attribute_group;
|
||||
chip->indio_dev->event_attrs = adt7410_event_attribute_group;
|
||||
chip->indio_dev->info = &adt7410_info;
|
||||
chip->indio_dev->dev_data = (void *)chip;
|
||||
chip->indio_dev->driver_module = THIS_MODULE;
|
||||
chip->indio_dev->num_interrupt_lines = ADT7410_IRQS;
|
||||
chip->indio_dev->modes = INDIO_DIRECT_MODE;
|
||||
|
||||
ret = iio_device_register(chip->indio_dev);
|
||||
|
|
|
@ -534,6 +534,13 @@ static struct attribute_group adt75_event_attribute_group = {
|
|||
.attrs = adt75_event_attributes,
|
||||
};
|
||||
|
||||
static const struct iio_info adt75_info = {
|
||||
.attrs = &adt75_attribute_group,
|
||||
.num_interrupt_lines = 1,
|
||||
.event_attrs = &adt75_event_attribute_group,
|
||||
.driver_module = THIS_MODULE,
|
||||
};
|
||||
|
||||
/*
|
||||
* device probe and remove
|
||||
*/
|
||||
|
@ -562,11 +569,8 @@ static int __devinit adt75_probe(struct i2c_client *client,
|
|||
|
||||
chip->indio_dev->name = id->name;
|
||||
chip->indio_dev->dev.parent = &client->dev;
|
||||
chip->indio_dev->attrs = &adt75_attribute_group;
|
||||
chip->indio_dev->event_attrs = &adt75_event_attribute_group;
|
||||
chip->indio_dev->info = &adt75_info;
|
||||
chip->indio_dev->dev_data = (void *)chip;
|
||||
chip->indio_dev->driver_module = THIS_MODULE;
|
||||
chip->indio_dev->num_interrupt_lines = 1;
|
||||
chip->indio_dev->modes = INDIO_DIRECT_MODE;
|
||||
|
||||
ret = iio_device_register(chip->indio_dev);
|
||||
|
|
|
@ -154,7 +154,7 @@ enum max1363_modes {
|
|||
* @name: indentification string for chip
|
||||
* @bits: accuracy of the adc in bits
|
||||
* @int_vref_mv: the internal reference voltage
|
||||
* @monitor_mode: whether the chip supports monitor interrupts
|
||||
* @info: iio core function callbacks structure
|
||||
* @mode_list: array of available scan modes
|
||||
* @num_modes: the number of scan modes available
|
||||
* @default_mode: the scan mode in which the chip starts up
|
||||
|
@ -162,14 +162,14 @@ enum max1363_modes {
|
|||
* @num_channels: number of channels
|
||||
*/
|
||||
struct max1363_chip_info {
|
||||
u8 bits;
|
||||
u16 int_vref_mv;
|
||||
bool monitor_mode;
|
||||
const enum max1363_modes *mode_list;
|
||||
int num_modes;
|
||||
enum max1363_modes default_mode;
|
||||
const struct iio_info *info;
|
||||
struct iio_chan_spec *channels;
|
||||
int num_channels;
|
||||
const enum max1363_modes *mode_list;
|
||||
enum max1363_modes default_mode;
|
||||
u16 int_vref_mv;
|
||||
u8 num_modes;
|
||||
u8 bits;
|
||||
};
|
||||
|
||||
/**
|
||||
|
|
|
@ -472,356 +472,6 @@ enum { max1361,
|
|||
max11647
|
||||
};
|
||||
|
||||
/* max1363 and max1368 tested - rest from data sheet */
|
||||
static const struct max1363_chip_info max1363_chip_info_tbl[] = {
|
||||
[max1361] = {
|
||||
.bits = 10,
|
||||
.int_vref_mv = 2048,
|
||||
.monitor_mode = 1,
|
||||
.mode_list = max1363_mode_list,
|
||||
.num_modes = ARRAY_SIZE(max1363_mode_list),
|
||||
.default_mode = s0to3,
|
||||
.channels = max1361_channels,
|
||||
.num_channels = ARRAY_SIZE(max1361_channels),
|
||||
},
|
||||
[max1362] = {
|
||||
.bits = 10,
|
||||
.int_vref_mv = 4096,
|
||||
.monitor_mode = 1,
|
||||
.mode_list = max1363_mode_list,
|
||||
.num_modes = ARRAY_SIZE(max1363_mode_list),
|
||||
.default_mode = s0to3,
|
||||
.channels = max1361_channels,
|
||||
.num_channels = ARRAY_SIZE(max1361_channels),
|
||||
},
|
||||
[max1363] = {
|
||||
.bits = 12,
|
||||
.int_vref_mv = 2048,
|
||||
.monitor_mode = 1,
|
||||
.mode_list = max1363_mode_list,
|
||||
.num_modes = ARRAY_SIZE(max1363_mode_list),
|
||||
.default_mode = s0to3,
|
||||
.channels = max1363_channels,
|
||||
.num_channels = ARRAY_SIZE(max1363_channels),
|
||||
},
|
||||
[max1364] = {
|
||||
.bits = 12,
|
||||
.int_vref_mv = 4096,
|
||||
.monitor_mode = 1,
|
||||
.mode_list = max1363_mode_list,
|
||||
.num_modes = ARRAY_SIZE(max1363_mode_list),
|
||||
.default_mode = s0to3,
|
||||
.channels = max1363_channels,
|
||||
.num_channels = ARRAY_SIZE(max1363_channels),
|
||||
},
|
||||
[max1036] = {
|
||||
.bits = 8,
|
||||
.int_vref_mv = 4096,
|
||||
.mode_list = max1236_mode_list,
|
||||
.num_modes = ARRAY_SIZE(max1236_mode_list),
|
||||
.default_mode = s0to3,
|
||||
.channels = max1036_channels,
|
||||
.num_channels = ARRAY_SIZE(max1036_channels),
|
||||
},
|
||||
[max1037] = {
|
||||
.bits = 8,
|
||||
.int_vref_mv = 2048,
|
||||
.mode_list = max1236_mode_list,
|
||||
.num_modes = ARRAY_SIZE(max1236_mode_list),
|
||||
.default_mode = s0to3,
|
||||
.channels = max1036_channels,
|
||||
.num_channels = ARRAY_SIZE(max1036_channels),
|
||||
},
|
||||
[max1038] = {
|
||||
.bits = 8,
|
||||
.int_vref_mv = 4096,
|
||||
.mode_list = max1238_mode_list,
|
||||
.num_modes = ARRAY_SIZE(max1238_mode_list),
|
||||
.default_mode = s0to11,
|
||||
.channels = max1038_channels,
|
||||
.num_channels = ARRAY_SIZE(max1038_channels),
|
||||
},
|
||||
[max1039] = {
|
||||
.bits = 8,
|
||||
.int_vref_mv = 2048,
|
||||
.mode_list = max1238_mode_list,
|
||||
.num_modes = ARRAY_SIZE(max1238_mode_list),
|
||||
.default_mode = s0to11,
|
||||
.channels = max1038_channels,
|
||||
.num_channels = ARRAY_SIZE(max1038_channels),
|
||||
},
|
||||
[max1136] = {
|
||||
.bits = 10,
|
||||
.int_vref_mv = 4096,
|
||||
.mode_list = max1236_mode_list,
|
||||
.num_modes = ARRAY_SIZE(max1236_mode_list),
|
||||
.default_mode = s0to3,
|
||||
.channels = max1136_channels,
|
||||
.num_channels = ARRAY_SIZE(max1136_channels),
|
||||
},
|
||||
[max1137] = {
|
||||
.bits = 10,
|
||||
.int_vref_mv = 2048,
|
||||
.mode_list = max1236_mode_list,
|
||||
.num_modes = ARRAY_SIZE(max1236_mode_list),
|
||||
.default_mode = s0to3,
|
||||
.channels = max1136_channels,
|
||||
.num_channels = ARRAY_SIZE(max1136_channels),
|
||||
},
|
||||
[max1138] = {
|
||||
.bits = 10,
|
||||
.int_vref_mv = 4096,
|
||||
.mode_list = max1238_mode_list,
|
||||
.num_modes = ARRAY_SIZE(max1238_mode_list),
|
||||
.default_mode = s0to11,
|
||||
.channels = max1138_channels,
|
||||
.num_channels = ARRAY_SIZE(max1138_channels),
|
||||
},
|
||||
[max1139] = {
|
||||
.bits = 10,
|
||||
.int_vref_mv = 2048,
|
||||
.mode_list = max1238_mode_list,
|
||||
.num_modes = ARRAY_SIZE(max1238_mode_list),
|
||||
.default_mode = s0to11,
|
||||
.channels = max1138_channels,
|
||||
.num_channels = ARRAY_SIZE(max1138_channels),
|
||||
},
|
||||
[max1236] = {
|
||||
.bits = 12,
|
||||
.int_vref_mv = 4096,
|
||||
.mode_list = max1236_mode_list,
|
||||
.num_modes = ARRAY_SIZE(max1236_mode_list),
|
||||
.default_mode = s0to3,
|
||||
.channels = max1236_channels,
|
||||
.num_channels = ARRAY_SIZE(max1236_channels),
|
||||
},
|
||||
[max1237] = {
|
||||
.bits = 12,
|
||||
.int_vref_mv = 2048,
|
||||
.mode_list = max1236_mode_list,
|
||||
.num_modes = ARRAY_SIZE(max1236_mode_list),
|
||||
.default_mode = s0to3,
|
||||
.channels = max1236_channels,
|
||||
.num_channels = ARRAY_SIZE(max1236_channels),
|
||||
},
|
||||
[max1238] = {
|
||||
.bits = 12,
|
||||
.int_vref_mv = 4096,
|
||||
.mode_list = max1238_mode_list,
|
||||
.num_modes = ARRAY_SIZE(max1238_mode_list),
|
||||
.default_mode = s0to11,
|
||||
.channels = max1238_channels,
|
||||
.num_channels = ARRAY_SIZE(max1238_channels),
|
||||
},
|
||||
[max1239] = {
|
||||
.bits = 12,
|
||||
.int_vref_mv = 2048,
|
||||
.mode_list = max1238_mode_list,
|
||||
.num_modes = ARRAY_SIZE(max1238_mode_list),
|
||||
.default_mode = s0to11,
|
||||
.channels = max1238_channels,
|
||||
.num_channels = ARRAY_SIZE(max1238_channels),
|
||||
},
|
||||
[max11600] = {
|
||||
.bits = 8,
|
||||
.int_vref_mv = 4096,
|
||||
.mode_list = max11607_mode_list,
|
||||
.num_modes = ARRAY_SIZE(max11607_mode_list),
|
||||
.default_mode = s0to3,
|
||||
.channels = max1036_channels,
|
||||
.num_channels = ARRAY_SIZE(max1036_channels),
|
||||
},
|
||||
[max11601] = {
|
||||
.bits = 8,
|
||||
.int_vref_mv = 2048,
|
||||
.mode_list = max11607_mode_list,
|
||||
.num_modes = ARRAY_SIZE(max11607_mode_list),
|
||||
.default_mode = s0to3,
|
||||
.channels = max1036_channels,
|
||||
.num_channels = ARRAY_SIZE(max1036_channels),
|
||||
},
|
||||
[max11602] = {
|
||||
.bits = 8,
|
||||
.int_vref_mv = 4096,
|
||||
.mode_list = max11608_mode_list,
|
||||
.num_modes = ARRAY_SIZE(max11608_mode_list),
|
||||
.default_mode = s0to7,
|
||||
.channels = max11602_channels,
|
||||
.num_channels = ARRAY_SIZE(max11602_channels),
|
||||
},
|
||||
[max11603] = {
|
||||
.bits = 8,
|
||||
.int_vref_mv = 2048,
|
||||
.mode_list = max11608_mode_list,
|
||||
.num_modes = ARRAY_SIZE(max11608_mode_list),
|
||||
.default_mode = s0to7,
|
||||
.channels = max11602_channels,
|
||||
.num_channels = ARRAY_SIZE(max11602_channels),
|
||||
},
|
||||
[max11604] = {
|
||||
.bits = 8,
|
||||
.int_vref_mv = 4098,
|
||||
.mode_list = max1238_mode_list,
|
||||
.num_modes = ARRAY_SIZE(max1238_mode_list),
|
||||
.default_mode = s0to11,
|
||||
.channels = max1238_channels,
|
||||
.num_channels = ARRAY_SIZE(max1238_channels),
|
||||
},
|
||||
[max11605] = {
|
||||
.bits = 8,
|
||||
.int_vref_mv = 2048,
|
||||
.mode_list = max1238_mode_list,
|
||||
.num_modes = ARRAY_SIZE(max1238_mode_list),
|
||||
.default_mode = s0to11,
|
||||
.channels = max1238_channels,
|
||||
.num_channels = ARRAY_SIZE(max1238_channels),
|
||||
},
|
||||
[max11606] = {
|
||||
.bits = 10,
|
||||
.int_vref_mv = 4096,
|
||||
.mode_list = max11607_mode_list,
|
||||
.num_modes = ARRAY_SIZE(max11607_mode_list),
|
||||
.default_mode = s0to3,
|
||||
.channels = max1136_channels,
|
||||
.num_channels = ARRAY_SIZE(max1136_channels),
|
||||
},
|
||||
[max11607] = {
|
||||
.bits = 10,
|
||||
.int_vref_mv = 2048,
|
||||
.mode_list = max11607_mode_list,
|
||||
.num_modes = ARRAY_SIZE(max11607_mode_list),
|
||||
.default_mode = s0to3,
|
||||
.channels = max1136_channels,
|
||||
.num_channels = ARRAY_SIZE(max1136_channels),
|
||||
},
|
||||
[max11608] = {
|
||||
.bits = 10,
|
||||
.int_vref_mv = 4096,
|
||||
.mode_list = max11608_mode_list,
|
||||
.num_modes = ARRAY_SIZE(max11608_mode_list),
|
||||
.default_mode = s0to7,
|
||||
.channels = max11608_channels,
|
||||
.num_channels = ARRAY_SIZE(max11608_channels),
|
||||
},
|
||||
[max11609] = {
|
||||
.bits = 10,
|
||||
.int_vref_mv = 2048,
|
||||
.mode_list = max11608_mode_list,
|
||||
.num_modes = ARRAY_SIZE(max11608_mode_list),
|
||||
.default_mode = s0to7,
|
||||
.channels = max11608_channels,
|
||||
.num_channels = ARRAY_SIZE(max11608_channels),
|
||||
},
|
||||
[max11610] = {
|
||||
.bits = 10,
|
||||
.int_vref_mv = 4098,
|
||||
.mode_list = max1238_mode_list,
|
||||
.num_modes = ARRAY_SIZE(max1238_mode_list),
|
||||
.default_mode = s0to11,
|
||||
.channels = max1238_channels,
|
||||
.num_channels = ARRAY_SIZE(max1238_channels),
|
||||
},
|
||||
[max11611] = {
|
||||
.bits = 10,
|
||||
.int_vref_mv = 2048,
|
||||
.mode_list = max1238_mode_list,
|
||||
.num_modes = ARRAY_SIZE(max1238_mode_list),
|
||||
.default_mode = s0to11,
|
||||
.channels = max1238_channels,
|
||||
.num_channels = ARRAY_SIZE(max1238_channels),
|
||||
},
|
||||
[max11612] = {
|
||||
.bits = 12,
|
||||
.int_vref_mv = 4096,
|
||||
.mode_list = max11607_mode_list,
|
||||
.num_modes = ARRAY_SIZE(max11607_mode_list),
|
||||
.default_mode = s0to3,
|
||||
.channels = max1363_channels,
|
||||
.num_channels = ARRAY_SIZE(max1363_channels),
|
||||
},
|
||||
[max11613] = {
|
||||
.bits = 12,
|
||||
.int_vref_mv = 2048,
|
||||
.mode_list = max11607_mode_list,
|
||||
.num_modes = ARRAY_SIZE(max11607_mode_list),
|
||||
.default_mode = s0to3,
|
||||
.channels = max1363_channels,
|
||||
.num_channels = ARRAY_SIZE(max1363_channels),
|
||||
},
|
||||
[max11614] = {
|
||||
.bits = 12,
|
||||
.int_vref_mv = 4096,
|
||||
.mode_list = max11608_mode_list,
|
||||
.num_modes = ARRAY_SIZE(max11608_mode_list),
|
||||
.default_mode = s0to7,
|
||||
.channels = max11614_channels,
|
||||
.num_channels = ARRAY_SIZE(max11614_channels),
|
||||
},
|
||||
[max11615] = {
|
||||
.bits = 12,
|
||||
.int_vref_mv = 2048,
|
||||
.mode_list = max11608_mode_list,
|
||||
.num_modes = ARRAY_SIZE(max11608_mode_list),
|
||||
.default_mode = s0to7,
|
||||
.channels = max11614_channels,
|
||||
.num_channels = ARRAY_SIZE(max11614_channels),
|
||||
},
|
||||
[max11616] = {
|
||||
.bits = 12,
|
||||
.int_vref_mv = 4098,
|
||||
.mode_list = max1238_mode_list,
|
||||
.num_modes = ARRAY_SIZE(max1238_mode_list),
|
||||
.default_mode = s0to11,
|
||||
.channels = max1238_channels,
|
||||
.num_channels = ARRAY_SIZE(max1238_channels),
|
||||
},
|
||||
[max11617] = {
|
||||
.bits = 12,
|
||||
.int_vref_mv = 2048,
|
||||
.mode_list = max1238_mode_list,
|
||||
.num_modes = ARRAY_SIZE(max1238_mode_list),
|
||||
.default_mode = s0to11,
|
||||
.channels = max1238_channels,
|
||||
.num_channels = ARRAY_SIZE(max1238_channels),
|
||||
},
|
||||
[max11644] = {
|
||||
.bits = 12,
|
||||
.int_vref_mv = 2048,
|
||||
.mode_list = max11644_mode_list,
|
||||
.num_modes = ARRAY_SIZE(max11644_mode_list),
|
||||
.default_mode = s0to1,
|
||||
.channels = max11644_channels,
|
||||
.num_channels = ARRAY_SIZE(max11644_channels),
|
||||
},
|
||||
[max11645] = {
|
||||
.bits = 12,
|
||||
.int_vref_mv = 4096,
|
||||
.mode_list = max11644_mode_list,
|
||||
.num_modes = ARRAY_SIZE(max11644_mode_list),
|
||||
.default_mode = s0to1,
|
||||
.channels = max11644_channels,
|
||||
.num_channels = ARRAY_SIZE(max11644_channels),
|
||||
},
|
||||
[max11646] = {
|
||||
.bits = 10,
|
||||
.int_vref_mv = 2048,
|
||||
.mode_list = max11644_mode_list,
|
||||
.num_modes = ARRAY_SIZE(max11644_mode_list),
|
||||
.default_mode = s0to1,
|
||||
.channels = max11644_channels,
|
||||
.num_channels = ARRAY_SIZE(max11646_channels),
|
||||
},
|
||||
[max11647] = {
|
||||
.bits = 10,
|
||||
.int_vref_mv = 4096,
|
||||
.mode_list = max11644_mode_list,
|
||||
.num_modes = ARRAY_SIZE(max11644_mode_list),
|
||||
.default_mode = s0to1,
|
||||
.channels = max11644_channels,
|
||||
.num_channels = ARRAY_SIZE(max11646_channels),
|
||||
},
|
||||
};
|
||||
|
||||
static const int max1363_monitor_speeds[] = { 133000, 665000, 33300, 16600,
|
||||
8300, 4200, 2000, 1000 };
|
||||
|
||||
|
@ -1165,6 +815,411 @@ static struct attribute_group max1363_event_attribute_group = {
|
|||
.attrs = max1363_event_attributes,
|
||||
};
|
||||
|
||||
#define MAX1363_EVENT_FUNCS \
|
||||
|
||||
|
||||
static const struct iio_info max1238_info = {
|
||||
.read_raw = &max1363_read_raw,
|
||||
.driver_module = THIS_MODULE,
|
||||
};
|
||||
|
||||
static const struct iio_info max1363_info = {
|
||||
.read_event_value = &max1363_read_thresh,
|
||||
.write_event_value = &max1363_write_thresh,
|
||||
.read_event_config = &max1363_read_event_config,
|
||||
.write_event_config = &max1363_write_event_config,
|
||||
.read_raw = &max1363_read_raw,
|
||||
.driver_module = THIS_MODULE,
|
||||
.num_interrupt_lines = 1,
|
||||
.event_attrs = &max1363_event_attribute_group,
|
||||
};
|
||||
|
||||
/* max1363 and max1368 tested - rest from data sheet */
|
||||
static const struct max1363_chip_info max1363_chip_info_tbl[] = {
|
||||
[max1361] = {
|
||||
.bits = 10,
|
||||
.int_vref_mv = 2048,
|
||||
.mode_list = max1363_mode_list,
|
||||
.num_modes = ARRAY_SIZE(max1363_mode_list),
|
||||
.default_mode = s0to3,
|
||||
.channels = max1361_channels,
|
||||
.num_channels = ARRAY_SIZE(max1361_channels),
|
||||
.info = &max1363_info,
|
||||
},
|
||||
[max1362] = {
|
||||
.bits = 10,
|
||||
.int_vref_mv = 4096,
|
||||
.mode_list = max1363_mode_list,
|
||||
.num_modes = ARRAY_SIZE(max1363_mode_list),
|
||||
.default_mode = s0to3,
|
||||
.channels = max1361_channels,
|
||||
.num_channels = ARRAY_SIZE(max1361_channels),
|
||||
.info = &max1363_info,
|
||||
},
|
||||
[max1363] = {
|
||||
.bits = 12,
|
||||
.int_vref_mv = 2048,
|
||||
.mode_list = max1363_mode_list,
|
||||
.num_modes = ARRAY_SIZE(max1363_mode_list),
|
||||
.default_mode = s0to3,
|
||||
.channels = max1363_channels,
|
||||
.num_channels = ARRAY_SIZE(max1363_channels),
|
||||
.info = &max1363_info,
|
||||
},
|
||||
[max1364] = {
|
||||
.bits = 12,
|
||||
.int_vref_mv = 4096,
|
||||
.mode_list = max1363_mode_list,
|
||||
.num_modes = ARRAY_SIZE(max1363_mode_list),
|
||||
.default_mode = s0to3,
|
||||
.channels = max1363_channels,
|
||||
.num_channels = ARRAY_SIZE(max1363_channels),
|
||||
.info = &max1363_info,
|
||||
},
|
||||
[max1036] = {
|
||||
.bits = 8,
|
||||
.int_vref_mv = 4096,
|
||||
.mode_list = max1236_mode_list,
|
||||
.num_modes = ARRAY_SIZE(max1236_mode_list),
|
||||
.default_mode = s0to3,
|
||||
.info = &max1238_info,
|
||||
.channels = max1036_channels,
|
||||
.num_channels = ARRAY_SIZE(max1036_channels),
|
||||
},
|
||||
[max1037] = {
|
||||
.bits = 8,
|
||||
.int_vref_mv = 2048,
|
||||
.mode_list = max1236_mode_list,
|
||||
.num_modes = ARRAY_SIZE(max1236_mode_list),
|
||||
.default_mode = s0to3,
|
||||
.info = &max1238_info,
|
||||
.channels = max1036_channels,
|
||||
.num_channels = ARRAY_SIZE(max1036_channels),
|
||||
},
|
||||
[max1038] = {
|
||||
.bits = 8,
|
||||
.int_vref_mv = 4096,
|
||||
.mode_list = max1238_mode_list,
|
||||
.num_modes = ARRAY_SIZE(max1238_mode_list),
|
||||
.default_mode = s0to11,
|
||||
.info = &max1238_info,
|
||||
.channels = max1038_channels,
|
||||
.num_channels = ARRAY_SIZE(max1038_channels),
|
||||
},
|
||||
[max1039] = {
|
||||
.bits = 8,
|
||||
.int_vref_mv = 2048,
|
||||
.mode_list = max1238_mode_list,
|
||||
.num_modes = ARRAY_SIZE(max1238_mode_list),
|
||||
.default_mode = s0to11,
|
||||
.info = &max1238_info,
|
||||
.channels = max1038_channels,
|
||||
.num_channels = ARRAY_SIZE(max1038_channels),
|
||||
},
|
||||
[max1136] = {
|
||||
.bits = 10,
|
||||
.int_vref_mv = 4096,
|
||||
.mode_list = max1236_mode_list,
|
||||
.num_modes = ARRAY_SIZE(max1236_mode_list),
|
||||
.default_mode = s0to3,
|
||||
.info = &max1238_info,
|
||||
.channels = max1136_channels,
|
||||
.num_channels = ARRAY_SIZE(max1136_channels),
|
||||
},
|
||||
[max1137] = {
|
||||
.bits = 10,
|
||||
.int_vref_mv = 2048,
|
||||
.mode_list = max1236_mode_list,
|
||||
.num_modes = ARRAY_SIZE(max1236_mode_list),
|
||||
.default_mode = s0to3,
|
||||
.info = &max1238_info,
|
||||
.channels = max1136_channels,
|
||||
.num_channels = ARRAY_SIZE(max1136_channels),
|
||||
},
|
||||
[max1138] = {
|
||||
.bits = 10,
|
||||
.int_vref_mv = 4096,
|
||||
.mode_list = max1238_mode_list,
|
||||
.num_modes = ARRAY_SIZE(max1238_mode_list),
|
||||
.default_mode = s0to11,
|
||||
.info = &max1238_info,
|
||||
.channels = max1138_channels,
|
||||
.num_channels = ARRAY_SIZE(max1138_channels),
|
||||
},
|
||||
[max1139] = {
|
||||
.bits = 10,
|
||||
.int_vref_mv = 2048,
|
||||
.mode_list = max1238_mode_list,
|
||||
.num_modes = ARRAY_SIZE(max1238_mode_list),
|
||||
.default_mode = s0to11,
|
||||
.info = &max1238_info,
|
||||
.channels = max1138_channels,
|
||||
.num_channels = ARRAY_SIZE(max1138_channels),
|
||||
},
|
||||
[max1236] = {
|
||||
.bits = 12,
|
||||
.int_vref_mv = 4096,
|
||||
.mode_list = max1236_mode_list,
|
||||
.num_modes = ARRAY_SIZE(max1236_mode_list),
|
||||
.default_mode = s0to3,
|
||||
.info = &max1238_info,
|
||||
.channels = max1236_channels,
|
||||
.num_channels = ARRAY_SIZE(max1236_channels),
|
||||
},
|
||||
[max1237] = {
|
||||
.bits = 12,
|
||||
.int_vref_mv = 2048,
|
||||
.mode_list = max1236_mode_list,
|
||||
.num_modes = ARRAY_SIZE(max1236_mode_list),
|
||||
.default_mode = s0to3,
|
||||
.info = &max1238_info,
|
||||
.channels = max1236_channels,
|
||||
.num_channels = ARRAY_SIZE(max1236_channels),
|
||||
},
|
||||
[max1238] = {
|
||||
.bits = 12,
|
||||
.int_vref_mv = 4096,
|
||||
.mode_list = max1238_mode_list,
|
||||
.num_modes = ARRAY_SIZE(max1238_mode_list),
|
||||
.default_mode = s0to11,
|
||||
.info = &max1238_info,
|
||||
.channels = max1238_channels,
|
||||
.num_channels = ARRAY_SIZE(max1238_channels),
|
||||
},
|
||||
[max1239] = {
|
||||
.bits = 12,
|
||||
.int_vref_mv = 2048,
|
||||
.mode_list = max1238_mode_list,
|
||||
.num_modes = ARRAY_SIZE(max1238_mode_list),
|
||||
.default_mode = s0to11,
|
||||
.info = &max1238_info,
|
||||
.channels = max1238_channels,
|
||||
.num_channels = ARRAY_SIZE(max1238_channels),
|
||||
},
|
||||
[max11600] = {
|
||||
.bits = 8,
|
||||
.int_vref_mv = 4096,
|
||||
.mode_list = max11607_mode_list,
|
||||
.num_modes = ARRAY_SIZE(max11607_mode_list),
|
||||
.default_mode = s0to3,
|
||||
.info = &max1238_info,
|
||||
.channels = max1036_channels,
|
||||
.num_channels = ARRAY_SIZE(max1036_channels),
|
||||
},
|
||||
[max11601] = {
|
||||
.bits = 8,
|
||||
.int_vref_mv = 2048,
|
||||
.mode_list = max11607_mode_list,
|
||||
.num_modes = ARRAY_SIZE(max11607_mode_list),
|
||||
.default_mode = s0to3,
|
||||
.info = &max1238_info,
|
||||
.channels = max1036_channels,
|
||||
.num_channels = ARRAY_SIZE(max1036_channels),
|
||||
},
|
||||
[max11602] = {
|
||||
.bits = 8,
|
||||
.int_vref_mv = 4096,
|
||||
.mode_list = max11608_mode_list,
|
||||
.num_modes = ARRAY_SIZE(max11608_mode_list),
|
||||
.default_mode = s0to7,
|
||||
.info = &max1238_info,
|
||||
.channels = max11602_channels,
|
||||
.num_channels = ARRAY_SIZE(max11602_channels),
|
||||
},
|
||||
[max11603] = {
|
||||
.bits = 8,
|
||||
.int_vref_mv = 2048,
|
||||
.mode_list = max11608_mode_list,
|
||||
.num_modes = ARRAY_SIZE(max11608_mode_list),
|
||||
.default_mode = s0to7,
|
||||
.info = &max1238_info,
|
||||
.channels = max11602_channels,
|
||||
.num_channels = ARRAY_SIZE(max11602_channels),
|
||||
},
|
||||
[max11604] = {
|
||||
.bits = 8,
|
||||
.int_vref_mv = 4098,
|
||||
.mode_list = max1238_mode_list,
|
||||
.num_modes = ARRAY_SIZE(max1238_mode_list),
|
||||
.default_mode = s0to11,
|
||||
.info = &max1238_info,
|
||||
.channels = max1238_channels,
|
||||
.num_channels = ARRAY_SIZE(max1238_channels),
|
||||
},
|
||||
[max11605] = {
|
||||
.bits = 8,
|
||||
.int_vref_mv = 2048,
|
||||
.mode_list = max1238_mode_list,
|
||||
.num_modes = ARRAY_SIZE(max1238_mode_list),
|
||||
.default_mode = s0to11,
|
||||
.info = &max1238_info,
|
||||
.channels = max1238_channels,
|
||||
.num_channels = ARRAY_SIZE(max1238_channels),
|
||||
},
|
||||
[max11606] = {
|
||||
.bits = 10,
|
||||
.int_vref_mv = 4096,
|
||||
.mode_list = max11607_mode_list,
|
||||
.num_modes = ARRAY_SIZE(max11607_mode_list),
|
||||
.default_mode = s0to3,
|
||||
.info = &max1238_info,
|
||||
.channels = max1136_channels,
|
||||
.num_channels = ARRAY_SIZE(max1136_channels),
|
||||
},
|
||||
[max11607] = {
|
||||
.bits = 10,
|
||||
.int_vref_mv = 2048,
|
||||
.mode_list = max11607_mode_list,
|
||||
.num_modes = ARRAY_SIZE(max11607_mode_list),
|
||||
.default_mode = s0to3,
|
||||
.info = &max1238_info,
|
||||
.channels = max1136_channels,
|
||||
.num_channels = ARRAY_SIZE(max1136_channels),
|
||||
},
|
||||
[max11608] = {
|
||||
.bits = 10,
|
||||
.int_vref_mv = 4096,
|
||||
.mode_list = max11608_mode_list,
|
||||
.num_modes = ARRAY_SIZE(max11608_mode_list),
|
||||
.default_mode = s0to7,
|
||||
.info = &max1238_info,
|
||||
.channels = max11608_channels,
|
||||
.num_channels = ARRAY_SIZE(max11608_channels),
|
||||
},
|
||||
[max11609] = {
|
||||
.bits = 10,
|
||||
.int_vref_mv = 2048,
|
||||
.mode_list = max11608_mode_list,
|
||||
.num_modes = ARRAY_SIZE(max11608_mode_list),
|
||||
.default_mode = s0to7,
|
||||
.info = &max1238_info,
|
||||
.channels = max11608_channels,
|
||||
.num_channels = ARRAY_SIZE(max11608_channels),
|
||||
},
|
||||
[max11610] = {
|
||||
.bits = 10,
|
||||
.int_vref_mv = 4098,
|
||||
.mode_list = max1238_mode_list,
|
||||
.num_modes = ARRAY_SIZE(max1238_mode_list),
|
||||
.default_mode = s0to11,
|
||||
.info = &max1238_info,
|
||||
.channels = max1238_channels,
|
||||
.num_channels = ARRAY_SIZE(max1238_channels),
|
||||
},
|
||||
[max11611] = {
|
||||
.bits = 10,
|
||||
.int_vref_mv = 2048,
|
||||
.mode_list = max1238_mode_list,
|
||||
.num_modes = ARRAY_SIZE(max1238_mode_list),
|
||||
.default_mode = s0to11,
|
||||
.info = &max1238_info,
|
||||
.channels = max1238_channels,
|
||||
.num_channels = ARRAY_SIZE(max1238_channels),
|
||||
},
|
||||
[max11612] = {
|
||||
.bits = 12,
|
||||
.int_vref_mv = 4096,
|
||||
.mode_list = max11607_mode_list,
|
||||
.num_modes = ARRAY_SIZE(max11607_mode_list),
|
||||
.default_mode = s0to3,
|
||||
.info = &max1238_info,
|
||||
.channels = max1363_channels,
|
||||
.num_channels = ARRAY_SIZE(max1363_channels),
|
||||
},
|
||||
[max11613] = {
|
||||
.bits = 12,
|
||||
.int_vref_mv = 2048,
|
||||
.mode_list = max11607_mode_list,
|
||||
.num_modes = ARRAY_SIZE(max11607_mode_list),
|
||||
.default_mode = s0to3,
|
||||
.info = &max1238_info,
|
||||
.channels = max1363_channels,
|
||||
.num_channels = ARRAY_SIZE(max1363_channels),
|
||||
},
|
||||
[max11614] = {
|
||||
.bits = 12,
|
||||
.int_vref_mv = 4096,
|
||||
.mode_list = max11608_mode_list,
|
||||
.num_modes = ARRAY_SIZE(max11608_mode_list),
|
||||
.default_mode = s0to7,
|
||||
.info = &max1238_info,
|
||||
.channels = max11614_channels,
|
||||
.num_channels = ARRAY_SIZE(max11614_channels),
|
||||
},
|
||||
[max11615] = {
|
||||
.bits = 12,
|
||||
.int_vref_mv = 2048,
|
||||
.mode_list = max11608_mode_list,
|
||||
.num_modes = ARRAY_SIZE(max11608_mode_list),
|
||||
.default_mode = s0to7,
|
||||
.info = &max1238_info,
|
||||
.channels = max11614_channels,
|
||||
.num_channels = ARRAY_SIZE(max11614_channels),
|
||||
},
|
||||
[max11616] = {
|
||||
.bits = 12,
|
||||
.int_vref_mv = 4098,
|
||||
.mode_list = max1238_mode_list,
|
||||
.num_modes = ARRAY_SIZE(max1238_mode_list),
|
||||
.default_mode = s0to11,
|
||||
.info = &max1238_info,
|
||||
.channels = max1238_channels,
|
||||
.num_channels = ARRAY_SIZE(max1238_channels),
|
||||
},
|
||||
[max11617] = {
|
||||
.bits = 12,
|
||||
.int_vref_mv = 2048,
|
||||
.mode_list = max1238_mode_list,
|
||||
.num_modes = ARRAY_SIZE(max1238_mode_list),
|
||||
.default_mode = s0to11,
|
||||
.info = &max1238_info,
|
||||
.channels = max1238_channels,
|
||||
.num_channels = ARRAY_SIZE(max1238_channels),
|
||||
},
|
||||
[max11644] = {
|
||||
.bits = 12,
|
||||
.int_vref_mv = 2048,
|
||||
.mode_list = max11644_mode_list,
|
||||
.num_modes = ARRAY_SIZE(max11644_mode_list),
|
||||
.default_mode = s0to1,
|
||||
.info = &max1238_info,
|
||||
.channels = max11644_channels,
|
||||
.num_channels = ARRAY_SIZE(max11644_channels),
|
||||
},
|
||||
[max11645] = {
|
||||
.bits = 12,
|
||||
.int_vref_mv = 4096,
|
||||
.mode_list = max11644_mode_list,
|
||||
.num_modes = ARRAY_SIZE(max11644_mode_list),
|
||||
.default_mode = s0to1,
|
||||
.info = &max1238_info,
|
||||
.channels = max11644_channels,
|
||||
.num_channels = ARRAY_SIZE(max11644_channels),
|
||||
},
|
||||
[max11646] = {
|
||||
.bits = 10,
|
||||
.int_vref_mv = 2048,
|
||||
.mode_list = max11644_mode_list,
|
||||
.num_modes = ARRAY_SIZE(max11644_mode_list),
|
||||
.default_mode = s0to1,
|
||||
.info = &max1238_info,
|
||||
.channels = max11646_channels,
|
||||
.num_channels = ARRAY_SIZE(max11646_channels),
|
||||
},
|
||||
[max11647] = {
|
||||
.bits = 10,
|
||||
.int_vref_mv = 4096,
|
||||
.mode_list = max11644_mode_list,
|
||||
.num_modes = ARRAY_SIZE(max11644_mode_list),
|
||||
.default_mode = s0to1,
|
||||
.info = &max1238_info,
|
||||
.channels = max11646_channels,
|
||||
.num_channels = ARRAY_SIZE(max11646_channels),
|
||||
},
|
||||
};
|
||||
|
||||
|
||||
|
||||
static int max1363_initial_setup(struct max1363_state *st)
|
||||
{
|
||||
st->setupbyte = MAX1363_SETUP_AIN3_IS_AIN3_REF_IS_VDD
|
||||
|
@ -1224,22 +1279,9 @@ static int __devinit max1363_probe(struct i2c_client *client,
|
|||
/* Estabilish that the iio_dev is a child of the i2c device */
|
||||
indio_dev->dev.parent = &client->dev;
|
||||
indio_dev->name = id->name;
|
||||
indio_dev->read_event_value = &max1363_read_thresh;
|
||||
indio_dev->write_event_value = &max1363_write_thresh;
|
||||
indio_dev->read_event_config = &max1363_read_event_config;
|
||||
indio_dev->write_event_config = &max1363_write_event_config;
|
||||
indio_dev->channels = st->chip_info->channels;
|
||||
indio_dev->num_channels = st->chip_info->num_channels;
|
||||
indio_dev->read_raw = &max1363_read_raw;
|
||||
/* Todo: this shouldn't be here. */
|
||||
indio_dev->driver_module = THIS_MODULE;
|
||||
indio_dev->modes = INDIO_DIRECT_MODE;
|
||||
if (st->chip_info->monitor_mode && client->irq) {
|
||||
indio_dev->num_interrupt_lines = 1;
|
||||
indio_dev->event_attrs
|
||||
= &max1363_event_attribute_group;
|
||||
}
|
||||
|
||||
indio_dev->info = st->chip_info->info;
|
||||
indio_dev->modes = INDIO_DIRECT_MODE;
|
||||
ret = max1363_initial_setup(st);
|
||||
if (ret)
|
||||
goto error_free_available_scan_masks;
|
||||
|
@ -1258,7 +1300,7 @@ static int __devinit max1363_probe(struct i2c_client *client,
|
|||
if (ret)
|
||||
goto error_cleanup_ring;
|
||||
|
||||
if (st->chip_info->monitor_mode && client->irq) {
|
||||
if (client->irq) {
|
||||
ret = request_threaded_irq(st->client->irq,
|
||||
NULL,
|
||||
&max1363_event_handler,
|
||||
|
@ -1298,7 +1340,7 @@ static int max1363_remove(struct i2c_client *client)
|
|||
struct max1363_state *st = iio_priv(indio_dev);
|
||||
struct regulator *reg = st->reg;
|
||||
|
||||
if (st->chip_info->monitor_mode && client->irq)
|
||||
if (client->irq)
|
||||
free_irq(st->client->irq, indio_dev);
|
||||
iio_ring_buffer_unregister(indio_dev->ring);
|
||||
max1363_ring_cleanup(indio_dev);
|
||||
|
|
|
@ -2106,6 +2106,20 @@ int adt7316_enable(struct device *dev)
|
|||
EXPORT_SYMBOL(adt7316_enable);
|
||||
#endif
|
||||
|
||||
static const struct iio_info adt7316_info = {
|
||||
.attrs = &adt7316_attribute_group,
|
||||
.num_interrupt_lines = 1,
|
||||
.event_attrs = &adt7316_event_attribute_group,
|
||||
.driver_module = THIS_MODULE,
|
||||
};
|
||||
|
||||
static const struct iio_info adt7516_info = {
|
||||
.attrs = &adt7516_attribute_group,
|
||||
.num_interrupt_lines = 1,
|
||||
.event_attrs = &adt7516_event_attribute_group,
|
||||
.driver_module = THIS_MODULE,
|
||||
};
|
||||
|
||||
/*
|
||||
* device probe and remove
|
||||
*/
|
||||
|
@ -2150,17 +2164,12 @@ int __devinit adt7316_probe(struct device *dev, struct adt7316_bus *bus,
|
|||
}
|
||||
|
||||
chip->indio_dev->dev.parent = dev;
|
||||
if ((chip->id & ID_FAMILY_MASK) == ID_ADT75XX) {
|
||||
chip->indio_dev->attrs = &adt7516_attribute_group;
|
||||
chip->indio_dev->event_attrs = &adt7516_event_attribute_group;
|
||||
} else {
|
||||
chip->indio_dev->attrs = &adt7316_attribute_group;
|
||||
chip->indio_dev->event_attrs = &adt7316_event_attribute_group;
|
||||
}
|
||||
if ((chip->id & ID_FAMILY_MASK) == ID_ADT75XX)
|
||||
chip->indio_dev->info = &adt7516_info;
|
||||
else
|
||||
chip->indio_dev->info = &adt7316_info;
|
||||
chip->indio_dev->name = name;
|
||||
chip->indio_dev->dev_data = (void *)chip;
|
||||
chip->indio_dev->driver_module = THIS_MODULE;
|
||||
chip->indio_dev->num_interrupt_lines = 1;
|
||||
chip->indio_dev->modes = INDIO_DIRECT_MODE;
|
||||
|
||||
ret = iio_device_register(chip->indio_dev);
|
||||
|
|
|
@ -334,6 +334,11 @@ static const struct ad5446_chip_info ad5446_chip_info_tbl[] = {
|
|||
},
|
||||
};
|
||||
|
||||
static const struct iio_info ad5446_info = {
|
||||
.attrs = &ad5446_attribute_group,
|
||||
.driver_module = THIS_MODULE,
|
||||
};
|
||||
|
||||
static int __devinit ad5446_probe(struct spi_device *spi)
|
||||
{
|
||||
struct ad5446_state *st;
|
||||
|
@ -370,9 +375,8 @@ static int __devinit ad5446_probe(struct spi_device *spi)
|
|||
/* Estabilish that the iio_dev is a child of the spi device */
|
||||
st->indio_dev->dev.parent = &spi->dev;
|
||||
st->indio_dev->name = spi_get_device_id(spi)->name;
|
||||
st->indio_dev->attrs = &ad5446_attribute_group;
|
||||
st->indio_dev->info = &ad5446_info;
|
||||
st->indio_dev->dev_data = (void *)(st);
|
||||
st->indio_dev->driver_module = THIS_MODULE;
|
||||
st->indio_dev->modes = INDIO_DIRECT_MODE;
|
||||
|
||||
/* Setup default message */
|
||||
|
|
|
@ -260,6 +260,20 @@ static irqreturn_t ad5504_event_handler(int irq, void *private)
|
|||
return IRQ_HANDLED;
|
||||
}
|
||||
|
||||
static const struct iio_info ad5504_info = {
|
||||
.attrs = &ad5504_attribute_group,
|
||||
.num_interrupt_lines = 1,
|
||||
.event_attrs = &ad5504_ev_attribute_group,
|
||||
.driver_module = THIS_MODULE,
|
||||
};
|
||||
|
||||
static const struct iio_info ad5501_info = {
|
||||
.attrs = &ad5501_attribute_group,
|
||||
.num_interrupt_lines = 1,
|
||||
.event_attrs = &ad5504_ev_attribute_group,
|
||||
.driver_module = THIS_MODULE,
|
||||
};
|
||||
|
||||
static int __devinit ad5504_probe(struct spi_device *spi)
|
||||
{
|
||||
struct ad5504_platform_data *pdata = spi->dev.platform_data;
|
||||
|
@ -298,14 +312,12 @@ static int __devinit ad5504_probe(struct spi_device *spi)
|
|||
}
|
||||
st->indio_dev->dev.parent = &spi->dev;
|
||||
st->indio_dev->name = spi_get_device_id(st->spi)->name;
|
||||
st->indio_dev->attrs = spi_get_device_id(st->spi)->driver_data
|
||||
== ID_AD5501 ? &ad5501_attribute_group :
|
||||
&ad5504_attribute_group;
|
||||
if (spi_get_device_id(st->spi)->driver_data == ID_AD5501)
|
||||
st->indio_dev->info = &ad5501_info;
|
||||
else
|
||||
st->indio_dev->info = &ad5504_info;
|
||||
st->indio_dev->dev_data = (void *)(st);
|
||||
st->indio_dev->driver_module = THIS_MODULE;
|
||||
st->indio_dev->modes = INDIO_DIRECT_MODE;
|
||||
st->indio_dev->num_interrupt_lines = 1;
|
||||
st->indio_dev->event_attrs = &ad5504_ev_attribute_group,
|
||||
|
||||
ret = iio_device_register(st->indio_dev);
|
||||
if (ret)
|
||||
|
|
|
@ -218,6 +218,11 @@ static const struct attribute_group ad5624r_attribute_group = {
|
|||
.attrs = ad5624r_attributes,
|
||||
};
|
||||
|
||||
static const struct iio_info ad5624r_info = {
|
||||
.attrs = &ad5624r_attribute_group,
|
||||
.driver_module = THIS_MODULE,
|
||||
};
|
||||
|
||||
static int __devinit ad5624r_probe(struct spi_device *spi)
|
||||
{
|
||||
struct ad5624r_state *st;
|
||||
|
@ -255,9 +260,8 @@ static int __devinit ad5624r_probe(struct spi_device *spi)
|
|||
}
|
||||
st->indio_dev->dev.parent = &spi->dev;
|
||||
st->indio_dev->name = spi_get_device_id(spi)->name;
|
||||
st->indio_dev->attrs = &ad5624r_attribute_group;
|
||||
st->indio_dev->info = &ad5624r_info;
|
||||
st->indio_dev->dev_data = (void *)(st);
|
||||
st->indio_dev->driver_module = THIS_MODULE;
|
||||
st->indio_dev->modes = INDIO_DIRECT_MODE;
|
||||
|
||||
ret = iio_device_register(st->indio_dev);
|
||||
|
|
|
@ -287,6 +287,11 @@ static const struct ad5791_chip_info ad5791_chip_info_tbl[] = {
|
|||
},
|
||||
};
|
||||
|
||||
static const struct iio_info ad5791_info = {
|
||||
.attrs = &ad5791_attribute_group,
|
||||
.driver_module = THIS_MODULE,
|
||||
};
|
||||
|
||||
static int __devinit ad5791_probe(struct spi_device *spi)
|
||||
{
|
||||
struct ad5791_platform_data *pdata = spi->dev.platform_data;
|
||||
|
@ -353,8 +358,7 @@ static int __devinit ad5791_probe(struct spi_device *spi)
|
|||
}
|
||||
st->indio_dev->dev.parent = &spi->dev;
|
||||
st->indio_dev->dev_data = (void *)(st);
|
||||
st->indio_dev->attrs = &ad5791_attribute_group;
|
||||
st->indio_dev->driver_module = THIS_MODULE;
|
||||
st->indio_dev->info = &ad5791_info;
|
||||
st->indio_dev->modes = INDIO_DIRECT_MODE;
|
||||
|
||||
ret = iio_device_register(st->indio_dev);
|
||||
|
|
|
@ -189,6 +189,16 @@ static int max517_resume(struct i2c_client *client)
|
|||
return i2c_master_send(client, &outbuf, 1);
|
||||
}
|
||||
|
||||
static const struct iio_info max517_info = {
|
||||
.attrs = &max517_attribute_group,
|
||||
.driver_module = THIS_MODULE,
|
||||
};
|
||||
|
||||
static const struct iio_info max518_info = {
|
||||
.attrs = &max517_attribute_group,
|
||||
.driver_module = THIS_MODULE,
|
||||
};
|
||||
|
||||
static int max517_probe(struct i2c_client *client,
|
||||
const struct i2c_device_id *id)
|
||||
{
|
||||
|
@ -217,11 +227,10 @@ static int max517_probe(struct i2c_client *client,
|
|||
|
||||
/* reduced attribute set for MAX517 */
|
||||
if (id->driver_data == ID_MAX517)
|
||||
data->indio_dev->attrs = &max517_attribute_group;
|
||||
data->indio_dev->info = &max517_info;
|
||||
else
|
||||
data->indio_dev->attrs = &max518_attribute_group;
|
||||
data->indio_dev->info = &max518_info;
|
||||
data->indio_dev->dev_data = (void *)(data);
|
||||
data->indio_dev->driver_module = THIS_MODULE;
|
||||
data->indio_dev->modes = INDIO_DIRECT_MODE;
|
||||
|
||||
/*
|
||||
|
|
|
@ -87,6 +87,12 @@ static const struct attribute_group ad5930_attribute_group = {
|
|||
.attrs = ad5930_attributes,
|
||||
};
|
||||
|
||||
static const struct iio_info ad5930_info = {
|
||||
.attrs = &ad5930_attribute_group,
|
||||
|
||||
.driver_module = THIS_MODULE,
|
||||
};
|
||||
|
||||
static int __devinit ad5930_probe(struct spi_device *spi)
|
||||
{
|
||||
struct ad5930_state *st;
|
||||
|
@ -108,12 +114,8 @@ static int __devinit ad5930_probe(struct spi_device *spi)
|
|||
goto error_free_st;
|
||||
}
|
||||
st->idev->dev.parent = &spi->dev;
|
||||
st->idev->num_interrupt_lines = 0;
|
||||
st->idev->event_attrs = NULL;
|
||||
|
||||
st->idev->attrs = &ad5930_attribute_group;
|
||||
st->idev->dev_data = (void *)(st);
|
||||
st->idev->driver_module = THIS_MODULE;
|
||||
st->idev->info = &ad5930_info;
|
||||
st->idev->modes = INDIO_DIRECT_MODE;
|
||||
|
||||
ret = iio_device_register(st->idev);
|
||||
|
|
|
@ -195,6 +195,11 @@ static const struct attribute_group ad9832_attribute_group = {
|
|||
.attrs = ad9832_attributes,
|
||||
};
|
||||
|
||||
static const struct iio_info ad9832_info = {
|
||||
.attrs = &ad9832_attribute_group,
|
||||
.driver_module = THIS_MODULE,
|
||||
};
|
||||
|
||||
static int __devinit ad9832_probe(struct spi_device *spi)
|
||||
{
|
||||
struct ad9832_platform_data *pdata = spi->dev.platform_data;
|
||||
|
@ -232,9 +237,8 @@ static int __devinit ad9832_probe(struct spi_device *spi)
|
|||
|
||||
st->indio_dev->dev.parent = &spi->dev;
|
||||
st->indio_dev->name = spi_get_device_id(spi)->name;
|
||||
st->indio_dev->attrs = &ad9832_attribute_group;
|
||||
st->indio_dev->info = &ad9832_info;
|
||||
st->indio_dev->dev_data = (void *) st;
|
||||
st->indio_dev->driver_module = THIS_MODULE;
|
||||
st->indio_dev->modes = INDIO_DIRECT_MODE;
|
||||
|
||||
/* Setup default messages */
|
||||
|
|
|
@ -305,6 +305,11 @@ static const struct attribute_group ad9834_attribute_group = {
|
|||
.is_visible = ad9834_attr_is_visible,
|
||||
};
|
||||
|
||||
static const struct iio_info ad9834_info = {
|
||||
.attrs = &ad9834_attribute_group,
|
||||
.driver_module = THIS_MODULE,
|
||||
};
|
||||
|
||||
static int __devinit ad9834_probe(struct spi_device *spi)
|
||||
{
|
||||
struct ad9834_platform_data *pdata = spi->dev.platform_data;
|
||||
|
@ -344,9 +349,8 @@ static int __devinit ad9834_probe(struct spi_device *spi)
|
|||
|
||||
st->indio_dev->dev.parent = &spi->dev;
|
||||
st->indio_dev->name = spi_get_device_id(spi)->name;
|
||||
st->indio_dev->attrs = &ad9834_attribute_group;
|
||||
st->indio_dev->info = &ad9834_info;
|
||||
st->indio_dev->dev_data = (void *) st;
|
||||
st->indio_dev->driver_module = THIS_MODULE;
|
||||
st->indio_dev->modes = INDIO_DIRECT_MODE;
|
||||
|
||||
/* Setup default messages */
|
||||
|
|
|
@ -73,6 +73,11 @@ static const struct attribute_group ad9850_attribute_group = {
|
|||
.attrs = ad9850_attributes,
|
||||
};
|
||||
|
||||
static const struct iio_info ad9850_info = {
|
||||
.attrs = &ad9850_attribute_group,
|
||||
.driver_module = THIS_MODULE,
|
||||
};
|
||||
|
||||
static int __devinit ad9850_probe(struct spi_device *spi)
|
||||
{
|
||||
struct ad9850_state *st;
|
||||
|
@ -94,12 +99,9 @@ static int __devinit ad9850_probe(struct spi_device *spi)
|
|||
goto error_free_st;
|
||||
}
|
||||
st->idev->dev.parent = &spi->dev;
|
||||
st->idev->num_interrupt_lines = 0;
|
||||
st->idev->event_attrs = NULL;
|
||||
|
||||
st->idev->attrs = &ad9850_attribute_group;
|
||||
st->idev->info = &ad9850_info;
|
||||
st->idev->dev_data = (void *)(st);
|
||||
st->idev->driver_module = THIS_MODULE;
|
||||
st->idev->modes = INDIO_DIRECT_MODE;
|
||||
|
||||
ret = iio_device_register(st->idev);
|
||||
|
|
|
@ -222,6 +222,11 @@ static const struct attribute_group ad9852_attribute_group = {
|
|||
.attrs = ad9852_attributes,
|
||||
};
|
||||
|
||||
static const struct iio_info ad9852_info = {
|
||||
.attrs = &ad9852_attribute_group,
|
||||
.driver_module = THIS_MODULE,
|
||||
};
|
||||
|
||||
static int __devinit ad9852_probe(struct spi_device *spi)
|
||||
{
|
||||
struct ad9852_state *st;
|
||||
|
@ -243,12 +248,9 @@ static int __devinit ad9852_probe(struct spi_device *spi)
|
|||
goto error_free_st;
|
||||
}
|
||||
st->idev->dev.parent = &spi->dev;
|
||||
st->idev->num_interrupt_lines = 0;
|
||||
st->idev->event_attrs = NULL;
|
||||
|
||||
st->idev->attrs = &ad9852_attribute_group;
|
||||
st->idev->info = &ad9852_info;
|
||||
st->idev->dev_data = (void *)(st);
|
||||
st->idev->driver_module = THIS_MODULE;
|
||||
st->idev->modes = INDIO_DIRECT_MODE;
|
||||
|
||||
ret = iio_device_register(st->idev);
|
||||
|
|
|
@ -357,6 +357,11 @@ static const struct attribute_group ad9910_attribute_group = {
|
|||
.attrs = ad9910_attributes,
|
||||
};
|
||||
|
||||
static const struct iio_info ad9910_info = {
|
||||
.attrs = &ad9910_attribute_group,
|
||||
.driver_module = THIS_MODULE,
|
||||
};
|
||||
|
||||
static int __devinit ad9910_probe(struct spi_device *spi)
|
||||
{
|
||||
struct ad9910_state *st;
|
||||
|
@ -378,12 +383,9 @@ static int __devinit ad9910_probe(struct spi_device *spi)
|
|||
goto error_free_st;
|
||||
}
|
||||
st->idev->dev.parent = &spi->dev;
|
||||
st->idev->num_interrupt_lines = 0;
|
||||
st->idev->event_attrs = NULL;
|
||||
|
||||
st->idev->attrs = &ad9910_attribute_group;
|
||||
st->idev->info = &ad9910_info;
|
||||
st->idev->dev_data = (void *)(st);
|
||||
st->idev->driver_module = THIS_MODULE;
|
||||
st->idev->modes = INDIO_DIRECT_MODE;
|
||||
|
||||
ret = iio_device_register(st->idev);
|
||||
|
|
|
@ -166,6 +166,11 @@ static const struct attribute_group ad9951_attribute_group = {
|
|||
.attrs = ad9951_attributes,
|
||||
};
|
||||
|
||||
static const struct iio_info ad9951_info = {
|
||||
.attrs = &ad9951_attribute_group,
|
||||
.driver_module = THIS_MODULE,
|
||||
};
|
||||
|
||||
static int __devinit ad9951_probe(struct spi_device *spi)
|
||||
{
|
||||
struct ad9951_state *st;
|
||||
|
@ -187,12 +192,9 @@ static int __devinit ad9951_probe(struct spi_device *spi)
|
|||
goto error_free_st;
|
||||
}
|
||||
st->idev->dev.parent = &spi->dev;
|
||||
st->idev->num_interrupt_lines = 0;
|
||||
st->idev->event_attrs = NULL;
|
||||
|
||||
st->idev->attrs = &ad9951_attribute_group;
|
||||
st->idev->info = &ad9951_info;
|
||||
st->idev->dev_data = (void *)(st);
|
||||
st->idev->driver_module = THIS_MODULE;
|
||||
st->idev->modes = INDIO_DIRECT_MODE;
|
||||
|
||||
ret = iio_device_register(st->idev);
|
||||
|
|
|
@ -133,6 +133,11 @@ static const struct attribute_group adis16060_attribute_group = {
|
|||
.attrs = adis16060_attributes,
|
||||
};
|
||||
|
||||
static const struct iio_info adis16060_info = {
|
||||
.attrs = &adis16060_attribute_group,
|
||||
.driver_module = THIS_MODULE,
|
||||
};
|
||||
|
||||
static int __devinit adis16060_r_probe(struct spi_device *spi)
|
||||
{
|
||||
int ret, regdone = 0;
|
||||
|
@ -154,9 +159,8 @@ static int __devinit adis16060_r_probe(struct spi_device *spi)
|
|||
}
|
||||
|
||||
st->indio_dev->dev.parent = &spi->dev;
|
||||
st->indio_dev->attrs = &adis16060_attribute_group;
|
||||
st->indio_dev->info = &adis16060_info;
|
||||
st->indio_dev->dev_data = (void *)(st);
|
||||
st->indio_dev->driver_module = THIS_MODULE;
|
||||
st->indio_dev->modes = INDIO_DIRECT_MODE;
|
||||
|
||||
ret = iio_device_register(st->indio_dev);
|
||||
|
|
|
@ -123,6 +123,11 @@ static const struct attribute_group adis16080_attribute_group = {
|
|||
.attrs = adis16080_attributes,
|
||||
};
|
||||
|
||||
static const struct iio_info adis16080_info = {
|
||||
.attrs = &adis16080_attribute_group,
|
||||
.driver_module = THIS_MODULE,
|
||||
};
|
||||
|
||||
static int __devinit adis16080_probe(struct spi_device *spi)
|
||||
{
|
||||
int ret, regdone = 0;
|
||||
|
@ -146,9 +151,8 @@ static int __devinit adis16080_probe(struct spi_device *spi)
|
|||
|
||||
st->indio_dev->name = spi->dev.driver->name;
|
||||
st->indio_dev->dev.parent = &spi->dev;
|
||||
st->indio_dev->attrs = &adis16080_attribute_group;
|
||||
st->indio_dev->info = &adis16080_info;
|
||||
st->indio_dev->dev_data = (void *)(st);
|
||||
st->indio_dev->driver_module = THIS_MODULE;
|
||||
st->indio_dev->modes = INDIO_DIRECT_MODE;
|
||||
|
||||
ret = iio_device_register(st->indio_dev);
|
||||
|
|
|
@ -175,6 +175,11 @@ static const struct attribute_group adis16130_attribute_group = {
|
|||
.attrs = adis16130_attributes,
|
||||
};
|
||||
|
||||
static const struct iio_info adis16130_info = {
|
||||
.attrs = &adis16130_attribute_group,
|
||||
.driver_module = THIS_MODULE,
|
||||
};
|
||||
|
||||
static int __devinit adis16130_probe(struct spi_device *spi)
|
||||
{
|
||||
int ret;
|
||||
|
@ -196,9 +201,8 @@ static int __devinit adis16130_probe(struct spi_device *spi)
|
|||
|
||||
st->indio_dev->name = spi->dev.driver->name;
|
||||
st->indio_dev->dev.parent = &spi->dev;
|
||||
st->indio_dev->attrs = &adis16130_attribute_group;
|
||||
st->indio_dev->info = &adis16130_info;
|
||||
st->indio_dev->dev_data = (void *)(st);
|
||||
st->indio_dev->driver_module = THIS_MODULE;
|
||||
st->indio_dev->modes = INDIO_DIRECT_MODE;
|
||||
st->mode = 1;
|
||||
|
||||
|
|
|
@ -565,6 +565,13 @@ static const struct attribute_group adis16260_attribute_group = {
|
|||
.attrs = adis16260_attributes,
|
||||
};
|
||||
|
||||
static const struct iio_info adis16260_info = {
|
||||
.attrs = &adis16260_attribute_group,
|
||||
.read_raw = &adis16260_read_raw,
|
||||
.write_raw = &adis16260_write_raw,
|
||||
.driver_module = THIS_MODULE,
|
||||
};
|
||||
|
||||
static int __devinit adis16260_probe(struct spi_device *spi)
|
||||
{
|
||||
int ret, regdone = 0;
|
||||
|
@ -601,7 +608,7 @@ static int __devinit adis16260_probe(struct spi_device *spi)
|
|||
|
||||
st->indio_dev->name = spi_get_device_id(st->us)->name;
|
||||
st->indio_dev->dev.parent = &spi->dev;
|
||||
st->indio_dev->attrs = &adis16260_attribute_group;
|
||||
st->indio_dev->info = &adis16260_info;
|
||||
st->indio_dev->num_channels
|
||||
= ARRAY_SIZE(adis16260_channels_x);
|
||||
if (pd && pd->direction)
|
||||
|
@ -621,10 +628,7 @@ static int __devinit adis16260_probe(struct spi_device *spi)
|
|||
else
|
||||
st->indio_dev->channels = adis16260_channels_x;
|
||||
|
||||
st->indio_dev->read_raw = &adis16260_read_raw;
|
||||
st->indio_dev->write_raw = &adis16260_write_raw;
|
||||
st->indio_dev->dev_data = (void *)(st);
|
||||
st->indio_dev->driver_module = THIS_MODULE;
|
||||
st->indio_dev->modes = INDIO_DIRECT_MODE;
|
||||
|
||||
ret = adis16260_configure_ring(st->indio_dev);
|
||||
|
|
|
@ -349,6 +349,11 @@ static const struct attribute_group adxrs450_attribute_group = {
|
|||
.attrs = adxrs450_attributes,
|
||||
};
|
||||
|
||||
static const struct iio_info adxrs450_info = {
|
||||
.attrs = &adxrs450_attribute_group,
|
||||
.driver_module = THIS_MODULE,
|
||||
};
|
||||
|
||||
static int __devinit adxrs450_probe(struct spi_device *spi)
|
||||
{
|
||||
int ret, regdone = 0;
|
||||
|
@ -381,9 +386,8 @@ static int __devinit adxrs450_probe(struct spi_device *spi)
|
|||
}
|
||||
|
||||
st->indio_dev->dev.parent = &spi->dev;
|
||||
st->indio_dev->attrs = &adxrs450_attribute_group;
|
||||
st->indio_dev->info = &adxrs450_info;
|
||||
st->indio_dev->dev_data = (void *)(st);
|
||||
st->indio_dev->driver_module = THIS_MODULE;
|
||||
st->indio_dev->modes = INDIO_DIRECT_MODE;
|
||||
|
||||
ret = iio_device_register(st->indio_dev);
|
||||
|
|
|
@ -202,70 +202,34 @@ static inline s64 iio_get_time_ns(void)
|
|||
* call to iio_device_register. */
|
||||
#define IIO_VAL_INT 1
|
||||
#define IIO_VAL_INT_PLUS_MICRO 2
|
||||
|
||||
/**
|
||||
* struct iio_dev - industrial I/O device
|
||||
* @id: [INTERN] used to identify device internally
|
||||
* @dev_data: [DRIVER] device specific data
|
||||
* @modes: [DRIVER] operating modes supported by device
|
||||
* @currentmode: [DRIVER] current operating mode
|
||||
* @dev: [DRIVER] device structure, should be assigned a parent
|
||||
* and owner
|
||||
* @attrs: [DRIVER] general purpose device attributes
|
||||
* @driver_module: [DRIVER] module structure used to ensure correct
|
||||
* struct iio_info - constant information about device
|
||||
* @driver_module: module structure used to ensure correct
|
||||
* ownership of chrdevs etc
|
||||
* @num_interrupt_lines:[DRIVER] number of physical interrupt lines from device
|
||||
* @event_attrs: [DRIVER] event control attributes
|
||||
* @event_interfaces: [INTERN] event chrdevs associated with interrupt lines
|
||||
* @ring: [DRIVER] any ring buffer present
|
||||
* @mlock: [INTERN] lock used to prevent simultaneous device state
|
||||
* changes
|
||||
* @available_scan_masks: [DRIVER] optional array of allowed bitmasks
|
||||
* @trig: [INTERN] current device trigger (ring buffer modes)
|
||||
* @pollfunc: [DRIVER] function run on trigger being received
|
||||
* @channels: [DRIVER] channel specification structure table
|
||||
* @num_channels: [DRIVER] number of chanels specified in @channels.
|
||||
* @channel_attr_list: [INTERN] keep track of automatically created channel
|
||||
* attributes.
|
||||
* @name: [DRIVER] name of the device.
|
||||
* @read_raw: [DRIVER] function to request a value from the device.
|
||||
* @num_interrupt_lines:number of physical interrupt lines from device
|
||||
* @event_attrs: event control attributes
|
||||
* @attrs: general purpose device attributes
|
||||
* @read_raw: function to request a value from the device.
|
||||
* mask specifies which value. Note 0 means a reading of
|
||||
* the channel in question. Return value will specify the
|
||||
* type of value returned by the device. val and val2 will
|
||||
* contain the elements making up the returned value.
|
||||
* @write_raw: [DRIVER] function to write a value to the device.
|
||||
* @write_raw: function to write a value to the device.
|
||||
* Parameters are the same as for read_raw.
|
||||
* @read_event_config: [DRIVER] find out if the event is enabled.
|
||||
* @write_event_config: [DRIVER] set if the event is enabled.
|
||||
* @read_event_value: [DRIVER] read a value associated with the event. Meaning
|
||||
* @read_event_config: find out if the event is enabled.
|
||||
* @write_event_config: set if the event is enabled.
|
||||
* @read_event_value: read a value associated with the event. Meaning
|
||||
* is event dependant. event_code specifies which event.
|
||||
* @write_event_value: [DRIVER] write the value associate with the event.
|
||||
* @write_event_value: write the value associate with the event.
|
||||
* Meaning is event dependent.
|
||||
**/
|
||||
struct iio_dev {
|
||||
int id;
|
||||
void *dev_data;
|
||||
int modes;
|
||||
int currentmode;
|
||||
struct device dev;
|
||||
const struct attribute_group *attrs;
|
||||
struct iio_info {
|
||||
struct module *driver_module;
|
||||
|
||||
int num_interrupt_lines;
|
||||
struct attribute_group *event_attrs;
|
||||
struct iio_event_interface *event_interfaces;
|
||||
const struct attribute_group *attrs;
|
||||
|
||||
struct iio_ring_buffer *ring;
|
||||
struct mutex mlock;
|
||||
|
||||
u32 *available_scan_masks;
|
||||
struct iio_trigger *trig;
|
||||
struct iio_poll_func *pollfunc;
|
||||
|
||||
struct iio_chan_spec const *channels;
|
||||
int num_channels;
|
||||
struct list_head channel_attr_list;
|
||||
|
||||
const char *name;
|
||||
int (*read_raw)(struct iio_dev *indio_dev,
|
||||
struct iio_chan_spec const *chan,
|
||||
int *val,
|
||||
|
@ -293,6 +257,51 @@ struct iio_dev {
|
|||
int val);
|
||||
};
|
||||
|
||||
/**
|
||||
* struct iio_dev - industrial I/O device
|
||||
* @id: [INTERN] used to identify device internally
|
||||
* @dev_data: [DRIVER] device specific data
|
||||
* @modes: [DRIVER] operating modes supported by device
|
||||
* @currentmode: [DRIVER] current operating mode
|
||||
* @dev: [DRIVER] device structure, should be assigned a parent
|
||||
* and owner
|
||||
* @event_interfaces: [INTERN] event chrdevs associated with interrupt lines
|
||||
* @ring: [DRIVER] any ring buffer present
|
||||
* @mlock: [INTERN] lock used to prevent simultaneous device state
|
||||
* changes
|
||||
* @available_scan_masks: [DRIVER] optional array of allowed bitmasks
|
||||
* @trig: [INTERN] current device trigger (ring buffer modes)
|
||||
* @pollfunc: [DRIVER] function run on trigger being received
|
||||
* @channels: [DRIVER] channel specification structure table
|
||||
* @num_channels: [DRIVER] number of chanels specified in @channels.
|
||||
* @channel_attr_list: [INTERN] keep track of automatically created channel
|
||||
* attributes.
|
||||
* @name: [DRIVER] name of the device.
|
||||
**/
|
||||
struct iio_dev {
|
||||
int id;
|
||||
void *dev_data;
|
||||
int modes;
|
||||
int currentmode;
|
||||
struct device dev;
|
||||
|
||||
struct iio_event_interface *event_interfaces;
|
||||
|
||||
struct iio_ring_buffer *ring;
|
||||
struct mutex mlock;
|
||||
|
||||
u32 *available_scan_masks;
|
||||
struct iio_trigger *trig;
|
||||
struct iio_poll_func *pollfunc;
|
||||
|
||||
struct iio_chan_spec const *channels;
|
||||
int num_channels;
|
||||
|
||||
struct list_head channel_attr_list;
|
||||
const char *name;
|
||||
const struct iio_info *info;
|
||||
};
|
||||
|
||||
/**
|
||||
* iio_device_register() - register a device with the IIO subsystem
|
||||
* @dev_info: Device structure filled by the device driver
|
||||
|
|
|
@ -770,7 +770,12 @@ static struct adis16400_chip_info adis16400_chips[] = {
|
|||
}
|
||||
};
|
||||
|
||||
|
||||
static const struct iio_info adis16400_info = {
|
||||
.driver_module = THIS_MODULE,
|
||||
.read_raw = &adis16400_read_raw,
|
||||
.write_raw = &adis16400_write_raw,
|
||||
.attrs = &adis16400_attribute_group,
|
||||
};
|
||||
|
||||
static int __devinit adis16400_probe(struct spi_device *spi)
|
||||
{
|
||||
|
@ -792,12 +797,9 @@ static int __devinit adis16400_probe(struct spi_device *spi)
|
|||
st->variant = &adis16400_chips[spi_get_device_id(spi)->driver_data];
|
||||
indio_dev->dev.parent = &spi->dev;
|
||||
indio_dev->name = spi_get_device_id(spi)->name;
|
||||
indio_dev->attrs = &adis16400_attribute_group;
|
||||
indio_dev->channels = st->variant->channels;
|
||||
indio_dev->num_channels = st->variant->num_channels;
|
||||
indio_dev->read_raw = &adis16400_read_raw;
|
||||
indio_dev->write_raw = &adis16400_write_raw;
|
||||
indio_dev->driver_module = THIS_MODULE;
|
||||
indio_dev->info = &adis16400_info;
|
||||
indio_dev->modes = INDIO_DIRECT_MODE;
|
||||
|
||||
ret = adis16400_configure_ring(indio_dev);
|
||||
|
|
|
@ -383,8 +383,8 @@ static ssize_t iio_read_channel_info(struct device *dev,
|
|||
struct iio_dev *indio_dev = dev_get_drvdata(dev);
|
||||
struct iio_dev_attr *this_attr = to_iio_dev_attr(attr);
|
||||
int val, val2;
|
||||
int ret = indio_dev->read_raw(indio_dev, this_attr->c,
|
||||
&val, &val2, this_attr->address);
|
||||
int ret = indio_dev->info->read_raw(indio_dev, this_attr->c,
|
||||
&val, &val2, this_attr->address);
|
||||
|
||||
if (ret < 0)
|
||||
return ret;
|
||||
|
@ -411,7 +411,7 @@ static ssize_t iio_write_channel_info(struct device *dev,
|
|||
bool integer_part = true, negative = false;
|
||||
|
||||
/* Assumes decimal - precision based on number of digits */
|
||||
if (!indio_dev->write_raw)
|
||||
if (!indio_dev->info->write_raw)
|
||||
return -EINVAL;
|
||||
if (buf[0] == '-') {
|
||||
negative = true;
|
||||
|
@ -446,8 +446,8 @@ static ssize_t iio_write_channel_info(struct device *dev,
|
|||
micro = -micro;
|
||||
}
|
||||
|
||||
ret = indio_dev->write_raw(indio_dev, this_attr->c,
|
||||
integer, micro, this_attr->address);
|
||||
ret = indio_dev->info->write_raw(indio_dev, this_attr->c,
|
||||
integer, micro, this_attr->address);
|
||||
if (ret)
|
||||
return ret;
|
||||
|
||||
|
@ -707,8 +707,9 @@ static int iio_device_register_sysfs(struct iio_dev *dev_info)
|
|||
int i, ret = 0;
|
||||
struct iio_dev_attr *p, *n;
|
||||
|
||||
if (dev_info->attrs) {
|
||||
ret = sysfs_create_group(&dev_info->dev.kobj, dev_info->attrs);
|
||||
if (dev_info->info->attrs) {
|
||||
ret = sysfs_create_group(&dev_info->dev.kobj,
|
||||
dev_info->info->attrs);
|
||||
if (ret) {
|
||||
dev_err(dev_info->dev.parent,
|
||||
"Failed to register sysfs hooks\n");
|
||||
|
@ -744,8 +745,8 @@ error_clear_attrs:
|
|||
list_del(&p->l);
|
||||
iio_device_remove_and_free_read_attr(dev_info, p);
|
||||
}
|
||||
if (dev_info->attrs)
|
||||
sysfs_remove_group(&dev_info->dev.kobj, dev_info->attrs);
|
||||
if (dev_info->info->attrs)
|
||||
sysfs_remove_group(&dev_info->dev.kobj, dev_info->info->attrs);
|
||||
error_ret:
|
||||
return ret;
|
||||
|
||||
|
@ -764,8 +765,8 @@ static void iio_device_unregister_sysfs(struct iio_dev *dev_info)
|
|||
iio_device_remove_and_free_read_attr(dev_info, p);
|
||||
}
|
||||
|
||||
if (dev_info->attrs)
|
||||
sysfs_remove_group(&dev_info->dev.kobj, dev_info->attrs);
|
||||
if (dev_info->info->attrs)
|
||||
sysfs_remove_group(&dev_info->dev.kobj, dev_info->info->attrs);
|
||||
}
|
||||
|
||||
/* Return a negative errno on failure */
|
||||
|
@ -824,8 +825,9 @@ static ssize_t iio_ev_state_store(struct device *dev,
|
|||
if (ret < 0)
|
||||
return ret;
|
||||
|
||||
ret = indio_dev->write_event_config(indio_dev, this_attr->address,
|
||||
val);
|
||||
ret = indio_dev->info->write_event_config(indio_dev,
|
||||
this_attr->address,
|
||||
val);
|
||||
return (ret < 0) ? ret : len;
|
||||
}
|
||||
|
||||
|
@ -835,7 +837,8 @@ static ssize_t iio_ev_state_show(struct device *dev,
|
|||
{
|
||||
struct iio_dev *indio_dev = dev_get_drvdata(dev);
|
||||
struct iio_dev_attr *this_attr = to_iio_dev_attr(attr);
|
||||
int val = indio_dev->read_event_config(indio_dev, this_attr->address);
|
||||
int val = indio_dev->info->read_event_config(indio_dev,
|
||||
this_attr->address);
|
||||
|
||||
if (val < 0)
|
||||
return val;
|
||||
|
@ -851,8 +854,8 @@ static ssize_t iio_ev_value_show(struct device *dev,
|
|||
struct iio_dev_attr *this_attr = to_iio_dev_attr(attr);
|
||||
int val, ret;
|
||||
|
||||
ret = indio_dev->read_event_value(indio_dev,
|
||||
this_attr->address, &val);
|
||||
ret = indio_dev->info->read_event_value(indio_dev,
|
||||
this_attr->address, &val);
|
||||
if (ret < 0)
|
||||
return ret;
|
||||
|
||||
|
@ -873,8 +876,8 @@ static ssize_t iio_ev_value_store(struct device *dev,
|
|||
if (ret)
|
||||
return ret;
|
||||
|
||||
ret = indio_dev->write_event_value(indio_dev, this_attr->address,
|
||||
val);
|
||||
ret = indio_dev->info->write_event_value(indio_dev, this_attr->address,
|
||||
val);
|
||||
if (ret < 0)
|
||||
return ret;
|
||||
|
||||
|
@ -930,8 +933,7 @@ static int iio_device_add_event_sysfs(struct iio_dev *dev_info,
|
|||
extending the bitmask - but
|
||||
how far*/
|
||||
0,
|
||||
&dev_info->event_interfaces[0]
|
||||
.dev,
|
||||
&dev_info->event_interfaces[0].dev,
|
||||
&dev_info->event_interfaces[0].
|
||||
dev_attr_list);
|
||||
kfree(postfix);
|
||||
|
@ -1015,23 +1017,23 @@ static int iio_device_register_eventset(struct iio_dev *dev_info)
|
|||
{
|
||||
int ret = 0, i, j;
|
||||
|
||||
if (dev_info->num_interrupt_lines == 0)
|
||||
if (dev_info->info->num_interrupt_lines == 0)
|
||||
return 0;
|
||||
|
||||
dev_info->event_interfaces =
|
||||
kzalloc(sizeof(struct iio_event_interface)
|
||||
*dev_info->num_interrupt_lines,
|
||||
*dev_info->info->num_interrupt_lines,
|
||||
GFP_KERNEL);
|
||||
if (dev_info->event_interfaces == NULL) {
|
||||
ret = -ENOMEM;
|
||||
goto error_ret;
|
||||
}
|
||||
|
||||
for (i = 0; i < dev_info->num_interrupt_lines; i++) {
|
||||
for (i = 0; i < dev_info->info->num_interrupt_lines; i++) {
|
||||
ret = iio_setup_ev_int(&dev_info->event_interfaces[i],
|
||||
dev_name(&dev_info->dev),
|
||||
i,
|
||||
dev_info->driver_module,
|
||||
dev_info->info->driver_module,
|
||||
&dev_info->dev);
|
||||
if (ret) {
|
||||
dev_err(&dev_info->dev,
|
||||
|
@ -1042,11 +1044,12 @@ static int iio_device_register_eventset(struct iio_dev *dev_info)
|
|||
dev_set_drvdata(&dev_info->event_interfaces[i].dev,
|
||||
(void *)dev_info);
|
||||
|
||||
if (dev_info->event_attrs != NULL)
|
||||
if (dev_info->info->event_attrs != NULL)
|
||||
ret = sysfs_create_group(&dev_info
|
||||
->event_interfaces[i]
|
||||
.dev.kobj,
|
||||
&dev_info->event_attrs[i]);
|
||||
&dev_info->info
|
||||
->event_attrs[i]);
|
||||
|
||||
if (ret) {
|
||||
dev_err(&dev_info->dev,
|
||||
|
@ -1055,7 +1058,7 @@ static int iio_device_register_eventset(struct iio_dev *dev_info)
|
|||
}
|
||||
}
|
||||
|
||||
for (i = 0; i < dev_info->num_interrupt_lines; i++) {
|
||||
for (i = 0; i < dev_info->info->num_interrupt_lines; i++) {
|
||||
ret = __iio_add_event_config_attrs(dev_info, i);
|
||||
if (ret)
|
||||
goto error_unregister_config_attrs;
|
||||
|
@ -1066,13 +1069,13 @@ static int iio_device_register_eventset(struct iio_dev *dev_info)
|
|||
error_unregister_config_attrs:
|
||||
for (j = 0; j < i; j++)
|
||||
__iio_remove_event_config_attrs(dev_info, i);
|
||||
i = dev_info->num_interrupt_lines - 1;
|
||||
i = dev_info->info->num_interrupt_lines - 1;
|
||||
error_remove_sysfs_interfaces:
|
||||
for (j = 0; j < i; j++)
|
||||
if (dev_info->event_attrs != NULL)
|
||||
if (dev_info->info->event_attrs != NULL)
|
||||
sysfs_remove_group(&dev_info
|
||||
->event_interfaces[j].dev.kobj,
|
||||
&dev_info->event_attrs[j]);
|
||||
&dev_info->info->event_attrs[j]);
|
||||
error_free_setup_ev_ints:
|
||||
for (j = 0; j < i; j++)
|
||||
iio_free_ev_int(&dev_info->event_interfaces[j]);
|
||||
|
@ -1086,17 +1089,17 @@ static void iio_device_unregister_eventset(struct iio_dev *dev_info)
|
|||
{
|
||||
int i;
|
||||
|
||||
if (dev_info->num_interrupt_lines == 0)
|
||||
if (dev_info->info->num_interrupt_lines == 0)
|
||||
return;
|
||||
for (i = 0; i < dev_info->num_interrupt_lines; i++) {
|
||||
for (i = 0; i < dev_info->info->num_interrupt_lines; i++) {
|
||||
__iio_remove_event_config_attrs(dev_info, i);
|
||||
if (dev_info->event_attrs != NULL)
|
||||
if (dev_info->info->event_attrs != NULL)
|
||||
sysfs_remove_group(&dev_info
|
||||
->event_interfaces[i].dev.kobj,
|
||||
&dev_info->event_attrs[i]);
|
||||
&dev_info->info->event_attrs[i]);
|
||||
}
|
||||
|
||||
for (i = 0; i < dev_info->num_interrupt_lines; i++)
|
||||
for (i = 0; i < dev_info->info->num_interrupt_lines; i++)
|
||||
iio_free_ev_int(&dev_info->event_interfaces[i]);
|
||||
kfree(dev_info->event_interfaces);
|
||||
}
|
||||
|
|
|
@ -455,6 +455,11 @@ static int isl29018_chip_init(struct i2c_client *client)
|
|||
return 0;
|
||||
}
|
||||
|
||||
static const struct iio_info isl29108_info = {
|
||||
.attrs = &isl29108_group,
|
||||
.driver_module = THIS_MODULE,
|
||||
};
|
||||
|
||||
static int __devinit isl29018_probe(struct i2c_client *client,
|
||||
const struct i2c_device_id *id)
|
||||
{
|
||||
|
@ -485,11 +490,10 @@ static int __devinit isl29018_probe(struct i2c_client *client,
|
|||
dev_err(&client->dev, "iio allocation fails\n");
|
||||
goto exit_free;
|
||||
}
|
||||
chip->indio_dev->attrs = &isl29108_group;
|
||||
chip->indio_dev->info = &isl29108_info;
|
||||
chip->indio_dev->name = id->name;
|
||||
chip->indio_dev->dev.parent = &client->dev;
|
||||
chip->indio_dev->dev_data = (void *)(chip);
|
||||
chip->indio_dev->driver_module = THIS_MODULE;
|
||||
chip->indio_dev->modes = INDIO_DIRECT_MODE;
|
||||
err = iio_device_register(chip->indio_dev);
|
||||
if (err) {
|
||||
|
|
|
@ -688,6 +688,21 @@ error_ret:
|
|||
/*--------------------------------------------------------------*/
|
||||
static struct i2c_driver tsl2563_i2c_driver;
|
||||
|
||||
static const struct iio_info tsl2563_info_no_irq = {
|
||||
.driver_module = THIS_MODULE,
|
||||
};
|
||||
|
||||
static const struct iio_info tsl2563_info = {
|
||||
.driver_module = THIS_MODULE,
|
||||
.num_interrupt_lines = 1,
|
||||
.read_raw = &tsl2563_read_raw,
|
||||
.write_raw = &tsl2563_write_raw,
|
||||
.read_event_value = &tsl2563_read_thresh,
|
||||
.write_event_value = &tsl2563_write_thresh,
|
||||
.read_event_config = &tsl2563_read_interrupt_config,
|
||||
.write_event_config = &tsl2563_write_interrupt_config,
|
||||
};
|
||||
|
||||
static int __devinit tsl2563_probe(struct i2c_client *client,
|
||||
const struct i2c_device_id *device_id)
|
||||
{
|
||||
|
@ -736,17 +751,12 @@ static int __devinit tsl2563_probe(struct i2c_client *client,
|
|||
indio_dev->name = client->name;
|
||||
indio_dev->channels = tsl2563_channels;
|
||||
indio_dev->num_channels = ARRAY_SIZE(tsl2563_channels);
|
||||
indio_dev->read_raw = &tsl2563_read_raw;
|
||||
indio_dev->write_raw = &tsl2563_write_raw;
|
||||
indio_dev->read_event_value = &tsl2563_read_thresh;
|
||||
indio_dev->write_event_value = &tsl2563_write_thresh;
|
||||
indio_dev->read_event_config = &tsl2563_read_interrupt_config;
|
||||
indio_dev->write_event_config = &tsl2563_write_interrupt_config;
|
||||
indio_dev->dev.parent = &client->dev;
|
||||
indio_dev->driver_module = THIS_MODULE;
|
||||
indio_dev->modes = INDIO_DIRECT_MODE;
|
||||
if (client->irq)
|
||||
indio_dev->num_interrupt_lines = 1;
|
||||
indio_dev->info = &tsl2563_info;
|
||||
else
|
||||
indio_dev->info = &tsl2563_info_no_irq;
|
||||
ret = iio_device_register(indio_dev);
|
||||
if (ret)
|
||||
goto fail1;
|
||||
|
|
|
@ -786,6 +786,11 @@ static int taos_tsl258x_device(unsigned char *bufp)
|
|||
return ((bufp[TSL258X_CHIPID] & 0xf0) == 0x90);
|
||||
}
|
||||
|
||||
static const struct iio_info tsl2583_info = {
|
||||
.attrs = &tsl2583_attribute_group,
|
||||
.driver_module = THIS_MODULE,
|
||||
};
|
||||
|
||||
/*
|
||||
* Client probe function - When a valid device is found, the driver's device
|
||||
* data structure is updated, and initialization completes successfully.
|
||||
|
@ -854,10 +859,9 @@ static int __devinit taos_probe(struct i2c_client *clientp,
|
|||
goto fail1;
|
||||
}
|
||||
|
||||
chip->iio_dev->attrs = &tsl2583_attribute_group;
|
||||
chip->iio_dev->info = &tsl2583_info;
|
||||
chip->iio_dev->dev.parent = &clientp->dev;
|
||||
chip->iio_dev->dev_data = (void *)(chip);
|
||||
chip->iio_dev->driver_module = THIS_MODULE;
|
||||
chip->iio_dev->modes = INDIO_DIRECT_MODE;
|
||||
ret = iio_device_register(chip->iio_dev);
|
||||
if (ret) {
|
||||
|
|
|
@ -474,6 +474,11 @@ static struct attribute_group ak8975_attr_group = {
|
|||
.attrs = ak8975_attr,
|
||||
};
|
||||
|
||||
static const struct iio_info ak8975_info = {
|
||||
.attrs = &ak8975_attr_group,
|
||||
.driver_module = THIS_MODULE,
|
||||
};
|
||||
|
||||
static int ak8975_probe(struct i2c_client *client,
|
||||
const struct i2c_device_id *id)
|
||||
{
|
||||
|
@ -533,9 +538,8 @@ static int ak8975_probe(struct i2c_client *client,
|
|||
}
|
||||
|
||||
data->indio_dev->dev.parent = &client->dev;
|
||||
data->indio_dev->attrs = &ak8975_attr_group;
|
||||
data->indio_dev->info = &ak8975_info;
|
||||
data->indio_dev->dev_data = (void *)(data);
|
||||
data->indio_dev->driver_module = THIS_MODULE;
|
||||
data->indio_dev->modes = INDIO_DIRECT_MODE;
|
||||
|
||||
err = iio_device_register(data->indio_dev);
|
||||
|
|
|
@ -529,6 +529,11 @@ static void hmc5843_init_client(struct i2c_client *client)
|
|||
pr_info("HMC5843 initialized\n");
|
||||
}
|
||||
|
||||
static const struct iio_info hmc5843_info = {
|
||||
.attrs = &hmc5843_group,
|
||||
.driver_module = THIS_MODULE,
|
||||
};
|
||||
|
||||
static int hmc5843_probe(struct i2c_client *client,
|
||||
const struct i2c_device_id *id)
|
||||
{
|
||||
|
@ -557,10 +562,9 @@ static int hmc5843_probe(struct i2c_client *client,
|
|||
err = -ENOMEM;
|
||||
goto exit_free1;
|
||||
}
|
||||
data->indio_dev->attrs = &hmc5843_group;
|
||||
data->indio_dev->info = &hmc5843_info;
|
||||
data->indio_dev->dev.parent = &client->dev;
|
||||
data->indio_dev->dev_data = (void *)(data);
|
||||
data->indio_dev->driver_module = THIS_MODULE;
|
||||
data->indio_dev->modes = INDIO_DIRECT_MODE;
|
||||
err = iio_device_register(data->indio_dev);
|
||||
if (err)
|
||||
|
|
|
@ -504,6 +504,11 @@ static const struct attribute_group ade7753_attribute_group = {
|
|||
.attrs = ade7753_attributes,
|
||||
};
|
||||
|
||||
static const struct iio_info ade7753_info = {
|
||||
.attrs = &ade7753_attribute_group,
|
||||
.driver_module = THIS_MODULE,
|
||||
};
|
||||
|
||||
static int __devinit ade7753_probe(struct spi_device *spi)
|
||||
{
|
||||
int ret, regdone = 0;
|
||||
|
@ -537,9 +542,8 @@ static int __devinit ade7753_probe(struct spi_device *spi)
|
|||
|
||||
st->indio_dev->name = spi->dev.driver->name;
|
||||
st->indio_dev->dev.parent = &spi->dev;
|
||||
st->indio_dev->attrs = &ade7753_attribute_group;
|
||||
st->indio_dev->info = &ade7753_info;
|
||||
st->indio_dev->dev_data = (void *)(st);
|
||||
st->indio_dev->driver_module = THIS_MODULE;
|
||||
st->indio_dev->modes = INDIO_DIRECT_MODE;
|
||||
|
||||
ret = iio_device_register(st->indio_dev);
|
||||
|
|
|
@ -527,7 +527,10 @@ static const struct attribute_group ade7754_attribute_group = {
|
|||
.attrs = ade7754_attributes,
|
||||
};
|
||||
|
||||
|
||||
static const struct iio_info ade7754_info = {
|
||||
.attrs = &ade7754_attribute_group,
|
||||
.driver_module = THIS_MODULE,
|
||||
};
|
||||
|
||||
static int __devinit ade7754_probe(struct spi_device *spi)
|
||||
{
|
||||
|
@ -562,9 +565,8 @@ static int __devinit ade7754_probe(struct spi_device *spi)
|
|||
|
||||
st->indio_dev->name = spi->dev.driver->name;
|
||||
st->indio_dev->dev.parent = &spi->dev;
|
||||
st->indio_dev->attrs = &ade7754_attribute_group;
|
||||
st->indio_dev->info = &ade7754_info;
|
||||
st->indio_dev->dev_data = (void *)(st);
|
||||
st->indio_dev->driver_module = THIS_MODULE;
|
||||
st->indio_dev->modes = INDIO_DIRECT_MODE;
|
||||
|
||||
ret = iio_device_register(st->indio_dev);
|
||||
|
|
|
@ -725,6 +725,11 @@ static struct iio_chan_spec ade7758_channels[] = {
|
|||
IIO_CHAN_SOFT_TIMESTAMP(15),
|
||||
};
|
||||
|
||||
static const struct iio_info ade7758_info = {
|
||||
.attrs = &ade7758_attribute_group,
|
||||
.driver_module = THIS_MODULE,
|
||||
};
|
||||
|
||||
static int __devinit ade7758_probe(struct spi_device *spi)
|
||||
{
|
||||
int i, ret, regdone = 0;
|
||||
|
@ -757,8 +762,7 @@ static int __devinit ade7758_probe(struct spi_device *spi)
|
|||
|
||||
indio_dev->name = spi->dev.driver->name;
|
||||
indio_dev->dev.parent = &spi->dev;
|
||||
indio_dev->attrs = &ade7758_attribute_group;
|
||||
indio_dev->driver_module = THIS_MODULE;
|
||||
indio_dev->info = &ade7758_info;
|
||||
indio_dev->modes = INDIO_DIRECT_MODE;
|
||||
|
||||
for (i = 0; i < AD7758_NUM_WAVESRC; i++)
|
||||
|
|
|
@ -450,6 +450,11 @@ static const struct attribute_group ade7759_attribute_group = {
|
|||
.attrs = ade7759_attributes,
|
||||
};
|
||||
|
||||
static const struct iio_info ade7759_info = {
|
||||
.attrs = &ade7759_attribute_group,
|
||||
.driver_module = THIS_MODULE,
|
||||
};
|
||||
|
||||
static int __devinit ade7759_probe(struct spi_device *spi)
|
||||
{
|
||||
int ret;
|
||||
|
@ -483,11 +488,9 @@ static int __devinit ade7759_probe(struct spi_device *spi)
|
|||
|
||||
st->indio_dev->name = spi->dev.driver->name;
|
||||
st->indio_dev->dev.parent = &spi->dev;
|
||||
st->indio_dev->num_interrupt_lines = 1;
|
||||
|
||||
st->indio_dev->attrs = &ade7759_attribute_group;
|
||||
st->indio_dev->info = &ade7759_info;
|
||||
st->indio_dev->dev_data = (void *)(st);
|
||||
st->indio_dev->driver_module = THIS_MODULE;
|
||||
st->indio_dev->modes = INDIO_DIRECT_MODE;
|
||||
|
||||
ret = iio_device_register(st->indio_dev);
|
||||
|
|
|
@ -551,6 +551,11 @@ static const struct attribute_group ade7854_attribute_group = {
|
|||
.attrs = ade7854_attributes,
|
||||
};
|
||||
|
||||
static const struct iio_info ade7854_info = {
|
||||
.attrs = &ade7854_attribute_group,
|
||||
.driver_module = THIS_MODULE,
|
||||
};
|
||||
|
||||
int ade7854_probe(struct ade7854_state *st, struct device *dev)
|
||||
{
|
||||
int ret;
|
||||
|
@ -575,9 +580,8 @@ int ade7854_probe(struct ade7854_state *st, struct device *dev)
|
|||
}
|
||||
|
||||
st->indio_dev->dev.parent = dev;
|
||||
st->indio_dev->attrs = &ade7854_attribute_group;
|
||||
st->indio_dev->info = &ade7854_info;
|
||||
st->indio_dev->dev_data = (void *)(st);
|
||||
st->indio_dev->driver_module = THIS_MODULE;
|
||||
st->indio_dev->modes = INDIO_DIRECT_MODE;
|
||||
|
||||
ret = iio_device_register(st->indio_dev);
|
||||
|
|
|
@ -209,10 +209,14 @@ static struct attribute *ad2s120x_attributes[] = {
|
|||
};
|
||||
|
||||
static const struct attribute_group ad2s120x_attribute_group = {
|
||||
.name = DRV_NAME,
|
||||
.attrs = ad2s120x_attributes,
|
||||
};
|
||||
|
||||
static const struct iio_info ad2s120x_info = {
|
||||
.attrs = &ad2s120x_attribute_group,
|
||||
.driver_module = THIS_MODULE,
|
||||
};
|
||||
|
||||
static int __devinit ad2s120x_probe(struct spi_device *spi)
|
||||
{
|
||||
struct ad2s120x_state *st;
|
||||
|
@ -246,12 +250,9 @@ static int __devinit ad2s120x_probe(struct spi_device *spi)
|
|||
goto error_free_st;
|
||||
}
|
||||
st->idev->dev.parent = &spi->dev;
|
||||
st->idev->num_interrupt_lines = 0;
|
||||
st->idev->event_attrs = NULL;
|
||||
|
||||
st->idev->attrs = &ad2s120x_attribute_group;
|
||||
st->idev->info = &ad2s120x_info;
|
||||
st->idev->dev_data = (void *)(st);
|
||||
st->idev->driver_module = THIS_MODULE;
|
||||
st->idev->modes = INDIO_DIRECT_MODE;
|
||||
|
||||
ret = iio_device_register(st->idev);
|
||||
|
|
|
@ -755,6 +755,11 @@ error_ret:
|
|||
return ret;
|
||||
}
|
||||
|
||||
static const struct iio_info ad2s1210_info = {
|
||||
.attrs = &ad2s1210_attribute_group,
|
||||
.driver_module = THIS_MODULE,
|
||||
};
|
||||
|
||||
static int __devinit ad2s1210_probe(struct spi_device *spi)
|
||||
{
|
||||
struct ad2s1210_state *st;
|
||||
|
@ -806,12 +811,9 @@ static int __devinit ad2s1210_probe(struct spi_device *spi)
|
|||
goto error_free_st;
|
||||
}
|
||||
st->idev->dev.parent = &spi->dev;
|
||||
st->idev->num_interrupt_lines = 0;
|
||||
st->idev->event_attrs = NULL;
|
||||
|
||||
st->idev->attrs = &ad2s1210_attribute_group;
|
||||
st->idev->info = &ad2s1210_info;
|
||||
st->idev->dev_data = (void *)(st);
|
||||
st->idev->driver_module = THIS_MODULE;
|
||||
st->idev->modes = INDIO_DIRECT_MODE;
|
||||
|
||||
ret = iio_device_register(st->idev);
|
||||
|
|
|
@ -75,6 +75,11 @@ static const struct attribute_group ad2s90_attribute_group = {
|
|||
.attrs = ad2s90_attributes,
|
||||
};
|
||||
|
||||
static const struct iio_info ad2s90_info = {
|
||||
.attrs = &ad2s90_attribute_group,
|
||||
.driver_module = THIS_MODULE,
|
||||
};
|
||||
|
||||
static int __devinit ad2s90_probe(struct spi_device *spi)
|
||||
{
|
||||
struct ad2s90_state *st;
|
||||
|
@ -96,12 +101,9 @@ static int __devinit ad2s90_probe(struct spi_device *spi)
|
|||
goto error_free_st;
|
||||
}
|
||||
st->idev->dev.parent = &spi->dev;
|
||||
st->idev->num_interrupt_lines = 0;
|
||||
st->idev->event_attrs = NULL;
|
||||
|
||||
st->idev->attrs = &ad2s90_attribute_group;
|
||||
st->idev->info = &ad2s90_info;
|
||||
st->idev->dev_data = (void *)(st);
|
||||
st->idev->driver_module = THIS_MODULE;
|
||||
st->idev->modes = INDIO_DIRECT_MODE;
|
||||
|
||||
ret = iio_device_register(st->idev);
|
||||
|
|
Loading…
Reference in New Issue