Lines Matching refs:indio_dev
66 int iio_push_event(struct iio_dev *indio_dev, u64 ev_code, s64 timestamp) in iio_push_event() argument
68 struct iio_dev_opaque *iio_dev_opaque = to_iio_dev_opaque(indio_dev); in iio_push_event()
102 struct iio_dev *indio_dev = filep->private_data; in iio_event_poll() local
103 struct iio_dev_opaque *iio_dev_opaque = to_iio_dev_opaque(indio_dev); in iio_event_poll()
107 if (!indio_dev->info) in iio_event_poll()
123 struct iio_dev *indio_dev = filep->private_data; in iio_event_chrdev_read() local
124 struct iio_dev_opaque *iio_dev_opaque = to_iio_dev_opaque(indio_dev); in iio_event_chrdev_read()
129 if (!indio_dev->info) in iio_event_chrdev_read()
142 indio_dev->info == NULL); in iio_event_chrdev_read()
145 if (indio_dev->info == NULL) in iio_event_chrdev_read()
173 struct iio_dev *indio_dev = filep->private_data; in iio_event_chrdev_release() local
174 struct iio_dev_opaque *iio_dev_opaque = to_iio_dev_opaque(indio_dev); in iio_event_chrdev_release()
179 iio_device_put(indio_dev); in iio_event_chrdev_release()
192 static int iio_event_getfd(struct iio_dev *indio_dev) in iio_event_getfd() argument
194 struct iio_dev_opaque *iio_dev_opaque = to_iio_dev_opaque(indio_dev); in iio_event_getfd()
201 fd = mutex_lock_interruptible(&indio_dev->mlock); in iio_event_getfd()
210 iio_device_get(indio_dev); in iio_event_getfd()
213 indio_dev, O_RDONLY | O_CLOEXEC); in iio_event_getfd()
216 iio_device_put(indio_dev); in iio_event_getfd()
222 mutex_unlock(&indio_dev->mlock); in iio_event_getfd()
277 struct iio_dev *indio_dev = dev_to_iio_dev(dev); in iio_ev_state_store() local
286 ret = indio_dev->info->write_event_config(indio_dev, in iio_ev_state_store()
297 struct iio_dev *indio_dev = dev_to_iio_dev(dev); in iio_ev_state_show() local
301 val = indio_dev->info->read_event_config(indio_dev, in iio_ev_state_show()
314 struct iio_dev *indio_dev = dev_to_iio_dev(dev); in iio_ev_value_show() local
319 ret = indio_dev->info->read_event_value(indio_dev, in iio_ev_value_show()
335 struct iio_dev *indio_dev = dev_to_iio_dev(dev); in iio_ev_value_store() local
340 if (!indio_dev->info->write_event_value) in iio_ev_value_store()
346 ret = indio_dev->info->write_event_value(indio_dev, in iio_ev_value_store()
356 static int iio_device_add_event(struct iio_dev *indio_dev, in iio_device_add_event() argument
361 struct iio_dev_opaque *iio_dev_opaque = to_iio_dev_opaque(indio_dev); in iio_device_add_event()
395 (i << 16) | spec_index, shared_by, &indio_dev->dev, in iio_device_add_event()
412 static int iio_device_add_event_sysfs(struct iio_dev *indio_dev, in iio_device_add_event_sysfs() argument
423 ret = iio_device_add_event(indio_dev, chan, i, type, dir, in iio_device_add_event_sysfs()
429 ret = iio_device_add_event(indio_dev, chan, i, type, dir, in iio_device_add_event_sysfs()
436 ret = iio_device_add_event(indio_dev, chan, i, type, dir, in iio_device_add_event_sysfs()
443 ret = iio_device_add_event(indio_dev, chan, i, type, dir, in iio_device_add_event_sysfs()
454 static inline int __iio_add_event_config_attrs(struct iio_dev *indio_dev) in __iio_add_event_config_attrs() argument
459 for (j = 0; j < indio_dev->num_channels; j++) { in __iio_add_event_config_attrs()
460 ret = iio_device_add_event_sysfs(indio_dev, in __iio_add_event_config_attrs()
461 &indio_dev->channels[j]); in __iio_add_event_config_attrs()
469 static bool iio_check_for_dynamic_events(struct iio_dev *indio_dev) in iio_check_for_dynamic_events() argument
473 for (j = 0; j < indio_dev->num_channels; j++) { in iio_check_for_dynamic_events()
474 if (indio_dev->channels[j].num_event_specs != 0) in iio_check_for_dynamic_events()
487 static long iio_event_ioctl(struct iio_dev *indio_dev, struct file *filp, in iio_event_ioctl() argument
494 fd = iio_event_getfd(indio_dev); in iio_event_ioctl()
506 int iio_device_register_eventset(struct iio_dev *indio_dev) in iio_device_register_eventset() argument
508 struct iio_dev_opaque *iio_dev_opaque = to_iio_dev_opaque(indio_dev); in iio_device_register_eventset()
514 if (!(indio_dev->info->event_attrs || in iio_device_register_eventset()
515 iio_check_for_dynamic_events(indio_dev))) in iio_device_register_eventset()
527 if (indio_dev->info->event_attrs != NULL) { in iio_device_register_eventset()
528 attr = indio_dev->info->event_attrs->attrs; in iio_device_register_eventset()
533 if (indio_dev->channels) { in iio_device_register_eventset()
534 ret = __iio_add_event_config_attrs(indio_dev); in iio_device_register_eventset()
548 if (indio_dev->info->event_attrs) in iio_device_register_eventset()
550 indio_dev->info->event_attrs->attrs, in iio_device_register_eventset()
557 ret = iio_device_register_sysfs_group(indio_dev, &ev_int->group); in iio_device_register_eventset()
562 iio_device_ioctl_handler_register(&iio_dev_opaque->indio_dev, in iio_device_register_eventset()
581 void iio_device_wakeup_eventset(struct iio_dev *indio_dev) in iio_device_wakeup_eventset() argument
583 struct iio_dev_opaque *iio_dev_opaque = to_iio_dev_opaque(indio_dev); in iio_device_wakeup_eventset()
590 void iio_device_unregister_eventset(struct iio_dev *indio_dev) in iio_device_unregister_eventset() argument
592 struct iio_dev_opaque *iio_dev_opaque = to_iio_dev_opaque(indio_dev); in iio_device_unregister_eventset()