#include <linux/regulator/consumer.h>
#include <linux/slab.h>
#include <linux/err.h>
+#include <linux/module.h>
#include "../iio.h"
#include "../sysfs.h"
}
static const int max1363_event_codes[] = {
- IIO_UNMOD_EVENT_CODE(IIO_EV_CLASS_IN, 0,
- IIO_EV_TYPE_THRESH, IIO_EV_DIR_FALLING),
- IIO_UNMOD_EVENT_CODE(IIO_EV_CLASS_IN, 1,
- IIO_EV_TYPE_THRESH, IIO_EV_DIR_FALLING),
- IIO_UNMOD_EVENT_CODE(IIO_EV_CLASS_IN, 2,
- IIO_EV_TYPE_THRESH, IIO_EV_DIR_FALLING),
- IIO_UNMOD_EVENT_CODE(IIO_EV_CLASS_IN, 3,
- IIO_EV_TYPE_THRESH, IIO_EV_DIR_FALLING),
- IIO_UNMOD_EVENT_CODE(IIO_EV_CLASS_IN, 0,
- IIO_EV_TYPE_THRESH, IIO_EV_DIR_RISING),
- IIO_UNMOD_EVENT_CODE(IIO_EV_CLASS_IN, 1,
- IIO_EV_TYPE_THRESH, IIO_EV_DIR_RISING),
- IIO_UNMOD_EVENT_CODE(IIO_EV_CLASS_IN, 2,
- IIO_EV_TYPE_THRESH, IIO_EV_DIR_RISING),
- IIO_UNMOD_EVENT_CODE(IIO_EV_CLASS_IN, 3,
- IIO_EV_TYPE_THRESH, IIO_EV_DIR_RISING),
+ IIO_UNMOD_EVENT_CODE(IIO_IN, 0, IIO_EV_TYPE_THRESH, IIO_EV_DIR_FALLING),
+ IIO_UNMOD_EVENT_CODE(IIO_IN, 1, IIO_EV_TYPE_THRESH, IIO_EV_DIR_FALLING),
+ IIO_UNMOD_EVENT_CODE(IIO_IN, 2, IIO_EV_TYPE_THRESH, IIO_EV_DIR_FALLING),
+ IIO_UNMOD_EVENT_CODE(IIO_IN, 3, IIO_EV_TYPE_THRESH, IIO_EV_DIR_FALLING),
+ IIO_UNMOD_EVENT_CODE(IIO_IN, 0, IIO_EV_TYPE_THRESH, IIO_EV_DIR_RISING),
+ IIO_UNMOD_EVENT_CODE(IIO_IN, 1, IIO_EV_TYPE_THRESH, IIO_EV_DIR_RISING),
+ IIO_UNMOD_EVENT_CODE(IIO_IN, 2, IIO_EV_TYPE_THRESH, IIO_EV_DIR_RISING),
+ IIO_UNMOD_EVENT_CODE(IIO_IN, 3, IIO_EV_TYPE_THRESH, IIO_EV_DIR_RISING),
};
static irqreturn_t max1363_event_handler(int irq, void *private)
static struct attribute_group max1363_event_attribute_group = {
.attrs = max1363_event_attributes,
+ .name = "events",
};
#define MAX1363_EVENT_FUNCS \
/* 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->channels = st->chip_info->channels;
+ indio_dev->num_channels = st->chip_info->num_channels;
indio_dev->info = st->chip_info->info;
indio_dev->modes = INDIO_DIRECT_MODE;
indio_dev->channels = st->chip_info->channels;
if (ret)
goto error_cleanup_ring;
regdone = 1;
- ret = iio_ring_buffer_register_ex(indio_dev->ring, 0,
+ ret = iio_ring_buffer_register_ex(indio_dev, 0,
st->chip_info->channels,
st->chip_info->num_channels);
if (ret)
return 0;
error_uninit_ring:
- iio_ring_buffer_unregister(indio_dev->ring);
+ iio_ring_buffer_unregister(indio_dev);
error_cleanup_ring:
max1363_ring_cleanup(indio_dev);
error_free_available_scan_masks:
if (client->irq)
free_irq(st->client->irq, indio_dev);
- iio_ring_buffer_unregister(indio_dev->ring);
+ iio_ring_buffer_unregister(indio_dev);
max1363_ring_cleanup(indio_dev);
kfree(indio_dev->available_scan_masks);
if (!IS_ERR(reg)) {