industrialio-trigger.c 16 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650
  1. /* The industrial I/O core, trigger handling functions
  2. *
  3. * Copyright (c) 2008 Jonathan Cameron
  4. *
  5. * This program is free software; you can redistribute it and/or modify it
  6. * under the terms of the GNU General Public License version 2 as published by
  7. * the Free Software Foundation.
  8. */
  9. #include <linux/kernel.h>
  10. #include <linux/idr.h>
  11. #include <linux/err.h>
  12. #include <linux/device.h>
  13. #include <linux/interrupt.h>
  14. #include <linux/list.h>
  15. #include <linux/slab.h>
  16. #include <linux/iio/iio.h>
  17. #include <linux/iio/trigger.h>
  18. #include "iio_core.h"
  19. #include "iio_core_trigger.h"
  20. #include <linux/iio/trigger_consumer.h>
  21. /* RFC - Question of approach
  22. * Make the common case (single sensor single trigger)
  23. * simple by starting trigger capture from when first sensors
  24. * is added.
  25. *
  26. * Complex simultaneous start requires use of 'hold' functionality
  27. * of the trigger. (not implemented)
  28. *
  29. * Any other suggestions?
  30. */
  31. static DEFINE_IDA(iio_trigger_ida);
  32. /* Single list of all available triggers */
  33. static LIST_HEAD(iio_trigger_list);
  34. static DEFINE_MUTEX(iio_trigger_list_lock);
  35. /**
  36. * iio_trigger_read_name() - retrieve useful identifying name
  37. * @dev: device associated with the iio_trigger
  38. * @attr: pointer to the device_attribute structure that is
  39. * being processed
  40. * @buf: buffer to print the name into
  41. *
  42. * Return: a negative number on failure or the number of written
  43. * characters on success.
  44. */
  45. static ssize_t iio_trigger_read_name(struct device *dev,
  46. struct device_attribute *attr,
  47. char *buf)
  48. {
  49. struct iio_trigger *trig = to_iio_trigger(dev);
  50. return sprintf(buf, "%s\n", trig->name);
  51. }
  52. static DEVICE_ATTR(name, S_IRUGO, iio_trigger_read_name, NULL);
  53. static struct attribute *iio_trig_dev_attrs[] = {
  54. &dev_attr_name.attr,
  55. NULL,
  56. };
  57. ATTRIBUTE_GROUPS(iio_trig_dev);
  58. static struct iio_trigger *__iio_trigger_find_by_name(const char *name);
  59. int iio_trigger_register(struct iio_trigger *trig_info)
  60. {
  61. int ret;
  62. /* trig_info->ops is required for the module member */
  63. if (!trig_info->ops)
  64. return -EINVAL;
  65. trig_info->id = ida_simple_get(&iio_trigger_ida, 0, 0, GFP_KERNEL);
  66. if (trig_info->id < 0)
  67. return trig_info->id;
  68. /* Set the name used for the sysfs directory etc */
  69. dev_set_name(&trig_info->dev, "trigger%ld",
  70. (unsigned long) trig_info->id);
  71. ret = device_add(&trig_info->dev);
  72. if (ret)
  73. goto error_unregister_id;
  74. /* Add to list of available triggers held by the IIO core */
  75. mutex_lock(&iio_trigger_list_lock);
  76. if (__iio_trigger_find_by_name(trig_info->name)) {
  77. pr_err("Duplicate trigger name '%s'\n", trig_info->name);
  78. ret = -EEXIST;
  79. goto error_device_del;
  80. }
  81. list_add_tail(&trig_info->list, &iio_trigger_list);
  82. mutex_unlock(&iio_trigger_list_lock);
  83. return 0;
  84. error_device_del:
  85. mutex_unlock(&iio_trigger_list_lock);
  86. device_del(&trig_info->dev);
  87. error_unregister_id:
  88. ida_simple_remove(&iio_trigger_ida, trig_info->id);
  89. return ret;
  90. }
  91. EXPORT_SYMBOL(iio_trigger_register);
  92. void iio_trigger_unregister(struct iio_trigger *trig_info)
  93. {
  94. mutex_lock(&iio_trigger_list_lock);
  95. list_del(&trig_info->list);
  96. mutex_unlock(&iio_trigger_list_lock);
  97. ida_simple_remove(&iio_trigger_ida, trig_info->id);
  98. /* Possible issue in here */
  99. device_del(&trig_info->dev);
  100. }
  101. EXPORT_SYMBOL(iio_trigger_unregister);
  102. /* Search for trigger by name, assuming iio_trigger_list_lock held */
  103. static struct iio_trigger *__iio_trigger_find_by_name(const char *name)
  104. {
  105. struct iio_trigger *iter;
  106. list_for_each_entry(iter, &iio_trigger_list, list)
  107. if (!strcmp(iter->name, name))
  108. return iter;
  109. return NULL;
  110. }
  111. static struct iio_trigger *iio_trigger_find_by_name(const char *name,
  112. size_t len)
  113. {
  114. struct iio_trigger *trig = NULL, *iter;
  115. mutex_lock(&iio_trigger_list_lock);
  116. list_for_each_entry(iter, &iio_trigger_list, list)
  117. if (sysfs_streq(iter->name, name)) {
  118. trig = iter;
  119. break;
  120. }
  121. mutex_unlock(&iio_trigger_list_lock);
  122. return trig;
  123. }
  124. void iio_trigger_poll(struct iio_trigger *trig)
  125. {
  126. int i;
  127. if (!atomic_read(&trig->use_count)) {
  128. atomic_set(&trig->use_count, CONFIG_IIO_CONSUMERS_PER_TRIGGER);
  129. for (i = 0; i < CONFIG_IIO_CONSUMERS_PER_TRIGGER; i++) {
  130. if (trig->subirqs[i].enabled)
  131. generic_handle_irq(trig->subirq_base + i);
  132. else
  133. iio_trigger_notify_done(trig);
  134. }
  135. }
  136. }
  137. EXPORT_SYMBOL(iio_trigger_poll);
  138. irqreturn_t iio_trigger_generic_data_rdy_poll(int irq, void *private)
  139. {
  140. iio_trigger_poll(private);
  141. return IRQ_HANDLED;
  142. }
  143. EXPORT_SYMBOL(iio_trigger_generic_data_rdy_poll);
  144. void iio_trigger_poll_chained(struct iio_trigger *trig)
  145. {
  146. int i;
  147. if (!atomic_read(&trig->use_count)) {
  148. atomic_set(&trig->use_count, CONFIG_IIO_CONSUMERS_PER_TRIGGER);
  149. for (i = 0; i < CONFIG_IIO_CONSUMERS_PER_TRIGGER; i++) {
  150. if (trig->subirqs[i].enabled)
  151. handle_nested_irq(trig->subirq_base + i);
  152. else
  153. iio_trigger_notify_done(trig);
  154. }
  155. }
  156. }
  157. EXPORT_SYMBOL(iio_trigger_poll_chained);
  158. void iio_trigger_notify_done(struct iio_trigger *trig)
  159. {
  160. if (atomic_dec_and_test(&trig->use_count) && trig->ops->try_reenable)
  161. if (trig->ops->try_reenable(trig))
  162. /* Missed an interrupt so launch new poll now */
  163. iio_trigger_poll(trig);
  164. }
  165. EXPORT_SYMBOL(iio_trigger_notify_done);
  166. /* Trigger Consumer related functions */
  167. static int iio_trigger_get_irq(struct iio_trigger *trig)
  168. {
  169. int ret;
  170. mutex_lock(&trig->pool_lock);
  171. ret = bitmap_find_free_region(trig->pool,
  172. CONFIG_IIO_CONSUMERS_PER_TRIGGER,
  173. ilog2(1));
  174. mutex_unlock(&trig->pool_lock);
  175. if (ret >= 0)
  176. ret += trig->subirq_base;
  177. return ret;
  178. }
  179. static void iio_trigger_put_irq(struct iio_trigger *trig, int irq)
  180. {
  181. mutex_lock(&trig->pool_lock);
  182. clear_bit(irq - trig->subirq_base, trig->pool);
  183. mutex_unlock(&trig->pool_lock);
  184. }
  185. /* Complexity in here. With certain triggers (datardy) an acknowledgement
  186. * may be needed if the pollfuncs do not include the data read for the
  187. * triggering device.
  188. * This is not currently handled. Alternative of not enabling trigger unless
  189. * the relevant function is in there may be the best option.
  190. */
  191. /* Worth protecting against double additions? */
  192. static int iio_trigger_attach_poll_func(struct iio_trigger *trig,
  193. struct iio_poll_func *pf)
  194. {
  195. int ret = 0;
  196. bool notinuse
  197. = bitmap_empty(trig->pool, CONFIG_IIO_CONSUMERS_PER_TRIGGER);
  198. /* Prevent the module from being removed whilst attached to a trigger */
  199. __module_get(pf->indio_dev->info->driver_module);
  200. /* Get irq number */
  201. pf->irq = iio_trigger_get_irq(trig);
  202. if (pf->irq < 0)
  203. goto out_put_module;
  204. /* Request irq */
  205. ret = request_threaded_irq(pf->irq, pf->h, pf->thread,
  206. pf->type, pf->name,
  207. pf);
  208. if (ret < 0)
  209. goto out_put_irq;
  210. /* Enable trigger in driver */
  211. if (trig->ops->set_trigger_state && notinuse) {
  212. ret = trig->ops->set_trigger_state(trig, true);
  213. if (ret < 0)
  214. goto out_free_irq;
  215. }
  216. return ret;
  217. out_free_irq:
  218. free_irq(pf->irq, pf);
  219. out_put_irq:
  220. iio_trigger_put_irq(trig, pf->irq);
  221. out_put_module:
  222. module_put(pf->indio_dev->info->driver_module);
  223. return ret;
  224. }
  225. static int iio_trigger_detach_poll_func(struct iio_trigger *trig,
  226. struct iio_poll_func *pf)
  227. {
  228. int ret = 0;
  229. bool no_other_users
  230. = (bitmap_weight(trig->pool,
  231. CONFIG_IIO_CONSUMERS_PER_TRIGGER)
  232. == 1);
  233. if (trig->ops->set_trigger_state && no_other_users) {
  234. ret = trig->ops->set_trigger_state(trig, false);
  235. if (ret)
  236. return ret;
  237. }
  238. iio_trigger_put_irq(trig, pf->irq);
  239. free_irq(pf->irq, pf);
  240. module_put(pf->indio_dev->info->driver_module);
  241. return ret;
  242. }
  243. irqreturn_t iio_pollfunc_store_time(int irq, void *p)
  244. {
  245. struct iio_poll_func *pf = p;
  246. pf->timestamp = iio_get_time_ns(pf->indio_dev);
  247. return IRQ_WAKE_THREAD;
  248. }
  249. EXPORT_SYMBOL(iio_pollfunc_store_time);
  250. struct iio_poll_func
  251. *iio_alloc_pollfunc(irqreturn_t (*h)(int irq, void *p),
  252. irqreturn_t (*thread)(int irq, void *p),
  253. int type,
  254. struct iio_dev *indio_dev,
  255. const char *fmt,
  256. ...)
  257. {
  258. va_list vargs;
  259. struct iio_poll_func *pf;
  260. pf = kmalloc(sizeof *pf, GFP_KERNEL);
  261. if (pf == NULL)
  262. return NULL;
  263. va_start(vargs, fmt);
  264. pf->name = kvasprintf(GFP_KERNEL, fmt, vargs);
  265. va_end(vargs);
  266. if (pf->name == NULL) {
  267. kfree(pf);
  268. return NULL;
  269. }
  270. pf->h = h;
  271. pf->thread = thread;
  272. pf->type = type;
  273. pf->indio_dev = indio_dev;
  274. return pf;
  275. }
  276. EXPORT_SYMBOL_GPL(iio_alloc_pollfunc);
  277. void iio_dealloc_pollfunc(struct iio_poll_func *pf)
  278. {
  279. kfree(pf->name);
  280. kfree(pf);
  281. }
  282. EXPORT_SYMBOL_GPL(iio_dealloc_pollfunc);
  283. /**
  284. * iio_trigger_read_current() - trigger consumer sysfs query current trigger
  285. * @dev: device associated with an industrial I/O device
  286. * @attr: pointer to the device_attribute structure that
  287. * is being processed
  288. * @buf: buffer where the current trigger name will be printed into
  289. *
  290. * For trigger consumers the current_trigger interface allows the trigger
  291. * used by the device to be queried.
  292. *
  293. * Return: a negative number on failure, the number of characters written
  294. * on success or 0 if no trigger is available
  295. */
  296. static ssize_t iio_trigger_read_current(struct device *dev,
  297. struct device_attribute *attr,
  298. char *buf)
  299. {
  300. struct iio_dev *indio_dev = dev_to_iio_dev(dev);
  301. if (indio_dev->trig)
  302. return sprintf(buf, "%s\n", indio_dev->trig->name);
  303. return 0;
  304. }
  305. /**
  306. * iio_trigger_write_current() - trigger consumer sysfs set current trigger
  307. * @dev: device associated with an industrial I/O device
  308. * @attr: device attribute that is being processed
  309. * @buf: string buffer that holds the name of the trigger
  310. * @len: length of the trigger name held by buf
  311. *
  312. * For trigger consumers the current_trigger interface allows the trigger
  313. * used for this device to be specified at run time based on the trigger's
  314. * name.
  315. *
  316. * Return: negative error code on failure or length of the buffer
  317. * on success
  318. */
  319. static ssize_t iio_trigger_write_current(struct device *dev,
  320. struct device_attribute *attr,
  321. const char *buf,
  322. size_t len)
  323. {
  324. struct iio_dev *indio_dev = dev_to_iio_dev(dev);
  325. struct iio_trigger *oldtrig = indio_dev->trig;
  326. struct iio_trigger *trig;
  327. int ret;
  328. mutex_lock(&indio_dev->mlock);
  329. if (indio_dev->currentmode == INDIO_BUFFER_TRIGGERED) {
  330. mutex_unlock(&indio_dev->mlock);
  331. return -EBUSY;
  332. }
  333. mutex_unlock(&indio_dev->mlock);
  334. trig = iio_trigger_find_by_name(buf, len);
  335. if (oldtrig == trig)
  336. return len;
  337. if (trig && indio_dev->info->validate_trigger) {
  338. ret = indio_dev->info->validate_trigger(indio_dev, trig);
  339. if (ret)
  340. return ret;
  341. }
  342. if (trig && trig->ops->validate_device) {
  343. ret = trig->ops->validate_device(trig, indio_dev);
  344. if (ret)
  345. return ret;
  346. }
  347. indio_dev->trig = trig;
  348. if (oldtrig) {
  349. if (indio_dev->modes & INDIO_EVENT_TRIGGERED)
  350. iio_trigger_detach_poll_func(oldtrig,
  351. indio_dev->pollfunc_event);
  352. iio_trigger_put(oldtrig);
  353. }
  354. if (indio_dev->trig) {
  355. iio_trigger_get(indio_dev->trig);
  356. if (indio_dev->modes & INDIO_EVENT_TRIGGERED)
  357. iio_trigger_attach_poll_func(indio_dev->trig,
  358. indio_dev->pollfunc_event);
  359. }
  360. return len;
  361. }
  362. static DEVICE_ATTR(current_trigger, S_IRUGO | S_IWUSR,
  363. iio_trigger_read_current,
  364. iio_trigger_write_current);
  365. static struct attribute *iio_trigger_consumer_attrs[] = {
  366. &dev_attr_current_trigger.attr,
  367. NULL,
  368. };
  369. static const struct attribute_group iio_trigger_consumer_attr_group = {
  370. .name = "trigger",
  371. .attrs = iio_trigger_consumer_attrs,
  372. };
  373. static void iio_trig_release(struct device *device)
  374. {
  375. struct iio_trigger *trig = to_iio_trigger(device);
  376. int i;
  377. if (trig->subirq_base) {
  378. for (i = 0; i < CONFIG_IIO_CONSUMERS_PER_TRIGGER; i++) {
  379. irq_modify_status(trig->subirq_base + i,
  380. IRQ_NOAUTOEN,
  381. IRQ_NOREQUEST | IRQ_NOPROBE);
  382. irq_set_chip(trig->subirq_base + i,
  383. NULL);
  384. irq_set_handler(trig->subirq_base + i,
  385. NULL);
  386. }
  387. irq_free_descs(trig->subirq_base,
  388. CONFIG_IIO_CONSUMERS_PER_TRIGGER);
  389. }
  390. kfree(trig->name);
  391. kfree(trig);
  392. }
  393. static struct device_type iio_trig_type = {
  394. .release = iio_trig_release,
  395. .groups = iio_trig_dev_groups,
  396. };
  397. static void iio_trig_subirqmask(struct irq_data *d)
  398. {
  399. struct irq_chip *chip = irq_data_get_irq_chip(d);
  400. struct iio_trigger *trig
  401. = container_of(chip,
  402. struct iio_trigger, subirq_chip);
  403. trig->subirqs[d->irq - trig->subirq_base].enabled = false;
  404. }
  405. static void iio_trig_subirqunmask(struct irq_data *d)
  406. {
  407. struct irq_chip *chip = irq_data_get_irq_chip(d);
  408. struct iio_trigger *trig
  409. = container_of(chip,
  410. struct iio_trigger, subirq_chip);
  411. trig->subirqs[d->irq - trig->subirq_base].enabled = true;
  412. }
  413. static struct iio_trigger *viio_trigger_alloc(const char *fmt, va_list vargs)
  414. {
  415. struct iio_trigger *trig;
  416. trig = kzalloc(sizeof *trig, GFP_KERNEL);
  417. if (trig) {
  418. int i;
  419. trig->dev.type = &iio_trig_type;
  420. trig->dev.bus = &iio_bus_type;
  421. device_initialize(&trig->dev);
  422. mutex_init(&trig->pool_lock);
  423. trig->subirq_base
  424. = irq_alloc_descs(-1, 0,
  425. CONFIG_IIO_CONSUMERS_PER_TRIGGER,
  426. 0);
  427. if (trig->subirq_base < 0) {
  428. kfree(trig);
  429. return NULL;
  430. }
  431. trig->name = kvasprintf(GFP_KERNEL, fmt, vargs);
  432. if (trig->name == NULL) {
  433. irq_free_descs(trig->subirq_base,
  434. CONFIG_IIO_CONSUMERS_PER_TRIGGER);
  435. kfree(trig);
  436. return NULL;
  437. }
  438. trig->subirq_chip.name = trig->name;
  439. trig->subirq_chip.irq_mask = &iio_trig_subirqmask;
  440. trig->subirq_chip.irq_unmask = &iio_trig_subirqunmask;
  441. for (i = 0; i < CONFIG_IIO_CONSUMERS_PER_TRIGGER; i++) {
  442. irq_set_chip(trig->subirq_base + i,
  443. &trig->subirq_chip);
  444. irq_set_handler(trig->subirq_base + i,
  445. &handle_simple_irq);
  446. irq_modify_status(trig->subirq_base + i,
  447. IRQ_NOREQUEST | IRQ_NOAUTOEN,
  448. IRQ_NOPROBE);
  449. }
  450. get_device(&trig->dev);
  451. }
  452. return trig;
  453. }
  454. struct iio_trigger *iio_trigger_alloc(const char *fmt, ...)
  455. {
  456. struct iio_trigger *trig;
  457. va_list vargs;
  458. va_start(vargs, fmt);
  459. trig = viio_trigger_alloc(fmt, vargs);
  460. va_end(vargs);
  461. return trig;
  462. }
  463. EXPORT_SYMBOL(iio_trigger_alloc);
  464. void iio_trigger_free(struct iio_trigger *trig)
  465. {
  466. if (trig)
  467. put_device(&trig->dev);
  468. }
  469. EXPORT_SYMBOL(iio_trigger_free);
  470. static void devm_iio_trigger_release(struct device *dev, void *res)
  471. {
  472. iio_trigger_free(*(struct iio_trigger **)res);
  473. }
  474. static int devm_iio_trigger_match(struct device *dev, void *res, void *data)
  475. {
  476. struct iio_trigger **r = res;
  477. if (!r || !*r) {
  478. WARN_ON(!r || !*r);
  479. return 0;
  480. }
  481. return *r == data;
  482. }
  483. /**
  484. * devm_iio_trigger_alloc - Resource-managed iio_trigger_alloc()
  485. * @dev: Device to allocate iio_trigger for
  486. * @fmt: trigger name format. If it includes format
  487. * specifiers, the additional arguments following
  488. * format are formatted and inserted in the resulting
  489. * string replacing their respective specifiers.
  490. *
  491. * Managed iio_trigger_alloc. iio_trigger allocated with this function is
  492. * automatically freed on driver detach.
  493. *
  494. * If an iio_trigger allocated with this function needs to be freed separately,
  495. * devm_iio_trigger_free() must be used.
  496. *
  497. * RETURNS:
  498. * Pointer to allocated iio_trigger on success, NULL on failure.
  499. */
  500. struct iio_trigger *devm_iio_trigger_alloc(struct device *dev,
  501. const char *fmt, ...)
  502. {
  503. struct iio_trigger **ptr, *trig;
  504. va_list vargs;
  505. ptr = devres_alloc(devm_iio_trigger_release, sizeof(*ptr),
  506. GFP_KERNEL);
  507. if (!ptr)
  508. return NULL;
  509. /* use raw alloc_dr for kmalloc caller tracing */
  510. va_start(vargs, fmt);
  511. trig = viio_trigger_alloc(fmt, vargs);
  512. va_end(vargs);
  513. if (trig) {
  514. *ptr = trig;
  515. devres_add(dev, ptr);
  516. } else {
  517. devres_free(ptr);
  518. }
  519. return trig;
  520. }
  521. EXPORT_SYMBOL_GPL(devm_iio_trigger_alloc);
  522. /**
  523. * devm_iio_trigger_free - Resource-managed iio_trigger_free()
  524. * @dev: Device this iio_dev belongs to
  525. * @iio_trig: the iio_trigger associated with the device
  526. *
  527. * Free iio_trigger allocated with devm_iio_trigger_alloc().
  528. */
  529. void devm_iio_trigger_free(struct device *dev, struct iio_trigger *iio_trig)
  530. {
  531. int rc;
  532. rc = devres_release(dev, devm_iio_trigger_release,
  533. devm_iio_trigger_match, iio_trig);
  534. WARN_ON(rc);
  535. }
  536. EXPORT_SYMBOL_GPL(devm_iio_trigger_free);
  537. void iio_device_register_trigger_consumer(struct iio_dev *indio_dev)
  538. {
  539. indio_dev->groups[indio_dev->groupcounter++] =
  540. &iio_trigger_consumer_attr_group;
  541. }
  542. void iio_device_unregister_trigger_consumer(struct iio_dev *indio_dev)
  543. {
  544. /* Clean up an associated but not attached trigger reference */
  545. if (indio_dev->trig)
  546. iio_trigger_put(indio_dev->trig);
  547. }
  548. int iio_triggered_buffer_postenable(struct iio_dev *indio_dev)
  549. {
  550. return iio_trigger_attach_poll_func(indio_dev->trig,
  551. indio_dev->pollfunc);
  552. }
  553. EXPORT_SYMBOL(iio_triggered_buffer_postenable);
  554. int iio_triggered_buffer_predisable(struct iio_dev *indio_dev)
  555. {
  556. return iio_trigger_detach_poll_func(indio_dev->trig,
  557. indio_dev->pollfunc);
  558. }
  559. EXPORT_SYMBOL(iio_triggered_buffer_predisable);