X-Git-Url: https://git.proxmox.com/?a=blobdiff_plain;f=drivers%2Fstaging%2Fiio%2Fadc%2Fad799x_core.c;h=cfe4b2caea8c672a5ef6ab978a57ad82be373ad5;hb=32b5eecab0f2d6f66f2e237e161d58d5916f8b13;hp=92cfe2e3ea4a81f5bb4e907ecb30974287557bec;hpb=bdc2209fd246820de2816691ac0e82600885e1a8;p=mirror_ubuntu-bionic-kernel.git diff --git a/drivers/staging/iio/adc/ad799x_core.c b/drivers/staging/iio/adc/ad799x_core.c index 92cfe2e3ea4a..cfe4b2caea8c 100644 --- a/drivers/staging/iio/adc/ad799x_core.c +++ b/drivers/staging/iio/adc/ad799x_core.c @@ -31,12 +31,12 @@ #include #include #include +#include #include "../iio.h" #include "../sysfs.h" - #include "../ring_generic.h" -#include "adc.h" + #include "ad799x.h" /* @@ -151,7 +151,7 @@ static int ad799x_read_raw(struct iio_dev *dev_info, mutex_lock(&dev_info->mlock); if (iio_ring_enabled(dev_info)) ret = ad799x_single_channel_from_ring(st, - 1 << chan->address); + chan->address); else ret = ad799x_scan_direct(st, chan->address); mutex_unlock(&dev_info->mlock); @@ -334,10 +334,16 @@ static irqreturn_t ad799x_event_handler(int irq, void *private) for (i = 0; i < 8; i++) { if (status & (1 << i)) - iio_push_event(indio_dev, 0, + iio_push_event(indio_dev, i & 0x1 ? - IIO_EVENT_CODE_IN_HIGH_THRESH(i >> 1) : - IIO_EVENT_CODE_IN_LOW_THRESH(i >> 1), + IIO_UNMOD_EVENT_CODE(IIO_IN, + (i >> 1), + IIO_EV_TYPE_THRESH, + IIO_EV_DIR_RISING) : + IIO_UNMOD_EVENT_CODE(IIO_IN, + (i >> 1), + IIO_EV_TYPE_THRESH, + IIO_EV_DIR_FALLING), iio_get_time_ns()); } @@ -441,6 +447,7 @@ static struct attribute *ad7993_4_7_8_event_attributes[] = { static struct attribute_group ad7993_4_7_8_event_attrs_group = { .attrs = ad7993_4_7_8_event_attributes, + .name = "events", }; static struct attribute *ad7992_event_attributes[] = { @@ -457,6 +464,7 @@ static struct attribute *ad7992_event_attributes[] = { static struct attribute_group ad7992_event_attrs_group = { .attrs = ad7992_event_attributes, + .name = "events", }; static const struct iio_info ad7991_info = { @@ -466,14 +474,12 @@ static const struct iio_info ad7991_info = { 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, }; @@ -700,9 +706,9 @@ static int __devinit ad799x_probe(struct i2c_client *client, goto error_cleanup_ring; regdone = 1; - ret = iio_ring_buffer_register_ex(indio_dev->ring, 0, - indio_dev->channels, - indio_dev->num_channels); + ret = iio_ring_buffer_register(indio_dev, + indio_dev->channels, + indio_dev->num_channels); if (ret) goto error_cleanup_ring; @@ -744,7 +750,7 @@ static __devexit int ad799x_remove(struct i2c_client *client) if (client->irq > 0) free_irq(client->irq, indio_dev); - iio_ring_buffer_unregister(indio_dev->ring); + iio_ring_buffer_unregister(indio_dev); ad799x_ring_cleanup(indio_dev); if (!IS_ERR(st->reg)) { regulator_disable(st->reg);