Lines Matching full:back

72 	struct iio_backend *back;  member
82 #define iio_backend_check_op(back, op) ({ \ argument
83 struct iio_backend *____back = back; \
92 #define iio_backend_op_call(back, op, args...) ({ \ argument
93 struct iio_backend *__back = back; \
103 #define iio_backend_ptr_op_call(back, op, args...) ({ \ argument
104 struct iio_backend *__back = back; \
117 #define iio_backend_void_op_call(back, op, args...) { \ argument
118 struct iio_backend *__back = back; \
133 struct iio_backend *back = file->private_data; in iio_backend_debugfs_read_reg() local
138 ret = iio_backend_op_call(back, debugfs_reg_access, in iio_backend_debugfs_read_reg()
139 back->cached_reg_addr, 0, &val); in iio_backend_debugfs_read_reg()
152 struct iio_backend *back = file->private_data; in iio_backend_debugfs_write_reg() local
162 ret = sscanf(buf, "%i %i", &back->cached_reg_addr, &val); in iio_backend_debugfs_write_reg()
168 ret = iio_backend_op_call(back, debugfs_reg_access, in iio_backend_debugfs_write_reg()
169 back->cached_reg_addr, val, NULL); in iio_backend_debugfs_write_reg()
188 struct iio_backend *back = file->private_data; in iio_backend_debugfs_read_name() local
192 len = scnprintf(name, sizeof(name), "%s\n", back->name); in iio_backend_debugfs_read_name()
204 * @back: Backend device
207 void iio_backend_debugfs_add(struct iio_backend *back, in iio_backend_debugfs_add() argument
216 if (!back->ops->debugfs_reg_access && !back->name) in iio_backend_debugfs_add()
219 snprintf(name, sizeof(name), "backend%d", back->idx); in iio_backend_debugfs_add()
225 if (back->ops->debugfs_reg_access) in iio_backend_debugfs_add()
226 debugfs_create_file("direct_reg_access", 0600, back_d, back, in iio_backend_debugfs_add()
229 if (back->name) in iio_backend_debugfs_add()
230 debugfs_create_file("name", 0400, back_d, back, in iio_backend_debugfs_add()
237 * @back: Backend device
249 ssize_t iio_backend_debugfs_print_chan_status(struct iio_backend *back, in iio_backend_debugfs_print_chan_status() argument
256 return iio_backend_op_call(back, debugfs_print_chan_status, chan, buf, in iio_backend_debugfs_print_chan_status()
263 * @back: Backend device
269 int iio_backend_chan_enable(struct iio_backend *back, unsigned int chan) in iio_backend_chan_enable() argument
271 return iio_backend_op_call(back, chan_enable, chan); in iio_backend_chan_enable()
277 * @back: Backend device
283 int iio_backend_chan_disable(struct iio_backend *back, unsigned int chan) in iio_backend_chan_disable() argument
285 return iio_backend_op_call(back, chan_disable, chan); in iio_backend_chan_disable()
289 static void __iio_backend_disable(void *back) in __iio_backend_disable() argument
291 iio_backend_void_op_call(back, disable); in __iio_backend_disable()
296 * @back: Backend device
298 void iio_backend_disable(struct iio_backend *back) in iio_backend_disable() argument
300 __iio_backend_disable(back); in iio_backend_disable()
306 * @back: Backend device
311 int iio_backend_enable(struct iio_backend *back) in iio_backend_enable() argument
313 return iio_backend_op_call(back, enable); in iio_backend_enable()
320 * @back: Backend device
325 int devm_iio_backend_enable(struct device *dev, struct iio_backend *back) in devm_iio_backend_enable() argument
329 ret = iio_backend_enable(back); in devm_iio_backend_enable()
333 return devm_add_action_or_reset(dev, __iio_backend_disable, back); in devm_iio_backend_enable()
339 * @back: Backend device
349 int iio_backend_data_format_set(struct iio_backend *back, unsigned int chan, in iio_backend_data_format_set() argument
355 return iio_backend_op_call(back, data_format_set, chan, data); in iio_backend_data_format_set()
361 * @back: Backend device
371 int iio_backend_data_source_set(struct iio_backend *back, unsigned int chan, in iio_backend_data_source_set() argument
377 return iio_backend_op_call(back, data_source_set, chan, data); in iio_backend_data_source_set()
383 * @back: Backend device
390 int iio_backend_set_sampling_freq(struct iio_backend *back, unsigned int chan, in iio_backend_set_sampling_freq() argument
393 return iio_backend_op_call(back, set_sample_rate, chan, sample_rate_hz); in iio_backend_set_sampling_freq()
399 * @back: Backend device
409 int iio_backend_test_pattern_set(struct iio_backend *back, in iio_backend_test_pattern_set() argument
416 return iio_backend_op_call(back, test_pattern_set, chan, pattern); in iio_backend_test_pattern_set()
422 * @back: Backend device
432 int iio_backend_chan_status(struct iio_backend *back, unsigned int chan, in iio_backend_chan_status() argument
435 return iio_backend_op_call(back, chan_status, chan, error); in iio_backend_chan_status()
441 * @back: Backend device
455 int iio_backend_iodelay_set(struct iio_backend *back, unsigned int lane, in iio_backend_iodelay_set() argument
458 return iio_backend_op_call(back, iodelay_set, lane, taps); in iio_backend_iodelay_set()
464 * @back: Backend device
473 int iio_backend_data_sample_trigger(struct iio_backend *back, in iio_backend_data_sample_trigger() argument
479 return iio_backend_op_call(back, data_sample_trigger, trigger); in iio_backend_data_sample_trigger()
487 iio_backend_void_op_call(pair->back, free_buffer, pair->buffer); in iio_backend_free_buffer()
493 * @back: Backend device
506 struct iio_backend *back, in devm_iio_backend_request_buffer() argument
516 buffer = iio_backend_ptr_op_call(back, request_buffer, indio_dev); in devm_iio_backend_request_buffer()
521 pair->back = back; in devm_iio_backend_request_buffer()
530 * @back: Backend device
539 int iio_backend_read_raw(struct iio_backend *back, in iio_backend_read_raw() argument
543 return iio_backend_op_call(back, read_raw, chan, val, val2, mask); in iio_backend_read_raw()
549 struct iio_backend *back = ERR_PTR(-ENODEV), *iter; in iio_backend_from_indio_dev_parent() local
561 if (!IS_ERR(back)) { in iio_backend_from_indio_dev_parent()
567 back = iter; in iio_backend_from_indio_dev_parent()
571 return back; in iio_backend_from_indio_dev_parent()
592 struct iio_backend *back; in iio_backend_ext_info_get() local
601 back = iio_backend_from_indio_dev_parent(indio_dev->dev.parent); in iio_backend_ext_info_get()
602 if (IS_ERR(back)) in iio_backend_ext_info_get()
603 return PTR_ERR(back); in iio_backend_ext_info_get()
605 return iio_backend_op_call(back, ext_info_get, private, chan, buf); in iio_backend_ext_info_get()
629 struct iio_backend *back; in iio_backend_ext_info_set() local
631 back = iio_backend_from_indio_dev_parent(indio_dev->dev.parent); in iio_backend_ext_info_set()
632 if (IS_ERR(back)) in iio_backend_ext_info_set()
633 return PTR_ERR(back); in iio_backend_ext_info_set()
635 return iio_backend_op_call(back, ext_info_set, private, chan, buf, len); in iio_backend_ext_info_set()
641 * @back: Backend device
650 int iio_backend_extend_chan_spec(struct iio_backend *back, in iio_backend_extend_chan_spec() argument
657 ret = iio_backend_op_call(back, extend_chan_spec, chan); in iio_backend_extend_chan_spec()
684 struct iio_backend *back = arg; in iio_backend_release() local
686 module_put(back->owner); in iio_backend_release()
689 static int __devm_iio_backend_get(struct device *dev, struct iio_backend *back) in __devm_iio_backend_get() argument
700 if (!try_module_get(back->owner)) in __devm_iio_backend_get()
704 ret = devm_add_action_or_reset(dev, iio_backend_release, back); in __devm_iio_backend_get()
708 link = device_link_add(dev, back->dev, DL_FLAG_AUTOREMOVE_CONSUMER); in __devm_iio_backend_get()
712 dev_name(back->dev)); in __devm_iio_backend_get()
714 back->frontend_dev = dev; in __devm_iio_backend_get()
716 dev_dbg(dev, "Found backend(%s) device\n", dev_name(back->dev)); in __devm_iio_backend_get()
725 struct iio_backend *back; in __devm_iio_backend_fwnode_get() local
745 list_for_each_entry(back, &iio_back_list, entry) { in __devm_iio_backend_fwnode_get()
746 if (!device_match_fwnode(back->dev, fwnode_back)) in __devm_iio_backend_fwnode_get()
750 ret = __devm_iio_backend_get(dev, back); in __devm_iio_backend_fwnode_get()
755 back->idx = index; in __devm_iio_backend_fwnode_get()
757 return back; in __devm_iio_backend_fwnode_get()
815 struct iio_backend *back; in __devm_iio_backend_get_from_fwnode_lookup() local
819 list_for_each_entry(back, &iio_back_list, entry) { in __devm_iio_backend_get_from_fwnode_lookup()
820 if (!device_match_fwnode(back->dev, fwnode)) in __devm_iio_backend_get_from_fwnode_lookup()
823 ret = __devm_iio_backend_get(dev, back); in __devm_iio_backend_get_from_fwnode_lookup()
827 return back; in __devm_iio_backend_get_from_fwnode_lookup()
836 * @back: Backend device
838 void *iio_backend_get_priv(const struct iio_backend *back) in iio_backend_get_priv() argument
840 return back->priv; in iio_backend_get_priv()
846 struct iio_backend *back = arg; in iio_backend_unregister() local
849 list_del(&back->entry); in iio_backend_unregister()
866 struct iio_backend *back; in devm_iio_backend_register() local
877 back = devm_kzalloc(dev, sizeof(*back), GFP_KERNEL); in devm_iio_backend_register()
878 if (!back) in devm_iio_backend_register()
881 back->ops = info->ops; in devm_iio_backend_register()
882 back->name = info->name; in devm_iio_backend_register()
883 back->owner = dev->driver->owner; in devm_iio_backend_register()
884 back->dev = dev; in devm_iio_backend_register()
885 back->priv = priv; in devm_iio_backend_register()
887 list_add(&back->entry, &iio_back_list); in devm_iio_backend_register()
889 return devm_add_action_or_reset(dev, iio_backend_unregister, back); in devm_iio_backend_register()