summaryrefslogtreecommitdiffstats
path: root/drivers/staging/iio/industrialio-trigger.c
Commit message (Collapse)AuthorAgeFilesLines
* staging:iio:trigger push functions that don't need to be generaly available ↵Jonathan Cameron2011-08-241-6/+24
| | | | | | | down into the core. Signed-off-by: Jonathan Cameron <jic23@cam.ac.uk> Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
* staging:iio:trigger core. Trivial code cleanups.Jonathan Cameron2011-08-241-15/+7Star
| | | | | | | | | Stop exporting functions only intended for core usage. Return void from function which can never return anything other than 0. Trivial stype cleanups. Signed-off-by: Jonathan Cameron <jic23@cam.ac.uk> Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
* staging:iio: spit trigger.h into provider and consumer parts.Jonathan Cameron2011-08-241-0/+1
| | | | | Signed-off-by: Jonathan Cameron <jic23@cam.ac.uk> Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
* staging:iio:rename trigger_consumer.h to indicate it is core only.Jonathan Cameron2011-08-241-1/+1
| | | | | | | | Need this out the way to create a trigger_consumer.h that actually is for trigger consumers. Signed-off-by: Jonathan Cameron <jic23@cam.ac.uk> Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
* staging:iio: prevent removal of module connected to trigger.Jonathan Cameron2011-08-241-0/+3
| | | | | Signed-off-by: Jonathan Cameron <jic23@cam.ac.uk> Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
* staging:iio:pollfunc: Make explicit that private data is always pointer to a ↵Jonathan Cameron2011-08-241-2/+2
| | | | | | | | | struct iio_dev. This is always true, so lets make it explicit. Signed-off-by: Jonathan Cameron <jic23@cam.ac.uk> Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
* staging:iio:triggers. Add a reference get to the core for triggers.Jonathan Cameron2011-08-241-1/+4
| | | | | | | | This is to do with dynamically allocated triggers and the need to ensure the underlying structures don't go away when a consumer is using them. Signed-off-by: Jonathan Cameron <jic23@cam.ac.uk> Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
* staging:iio: Introduce iio_core.h and move all core only stuff out of iio.h.Jonathan Cameron2011-08-231-0/+1
| | | | | | | | | Also get rid of a few function defs where they are only now in one core file anyway. Whilst here add mask = 0 to get rid of warning. Signed-off-by: Jonathan Cameron <jic23@cam.ac.uk> Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
* staging:iio:triggers introduce iio_trigger_ops to take const bits out of ↵Jonathan Cameron2011-08-231-8/+8
| | | | | | | | | | | | iio_trig_structure. Right now this results in increased code, but I still think it is worth doing to avoid replication across instances of drivers etc and move as much stuff as possible to constant. Ops structure is optional for the occasional driver that uses none of it (currently only the ad7793). Signed-off-by: Jonathan Cameron <jic23@cam.ac.uk> Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
* iio: trigger: Add filter callbackMichael Hennerich2011-06-281-1/+19
| | | | | | | | | | | | | | | Allow devices to reject triggers and vice versa. Changes since V1: Added kernel-doc Moved callback into iio_info Changed function naming Revised return value passing Add forward declaration to avoid warnings Signed-off-by: Michael Hennerich <michael.hennerich@analog.com> Acked-by: Jonathan Cameron <jic23@cam.ac.uk> Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
* staging: iio: industrialio-trigger: set iio_poll_func private_dataMichael Hennerich2011-06-071-0/+1
| | | | | | | | | Failure to set iio_poll_func private_data, causes zero pointer access violations in all consumer trigger handlers. Signed-off-by: Michael Hennerich <michael.hennerich@analog.com> Acked-by: Jonathan Cameron <jic23@cam.ac.uk> Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
* staging:iio: poll func allocation clean up.Jonathan Cameron2011-05-201-0/+36
| | | | | | | | Add a function to neatly deal with allocation of poll functions. Ultimately this allows us to more easily change the implementation. Signed-off-by: Jonathan Cameron <jic23@cam.ac.uk> Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
* staging:iio:trigger handle name attr in core, remove old alloc and register ↵Jonathan Cameron2011-05-201-52/+51Star
| | | | | | | | | | | | | | | | | | | any control_attrs via struct device As the majority of triggers don't actually have any other control_attrs lets use the fact that struct device has a groups element when we do need to have these attributes registered. A vargs function is used to cut down on lots of building strings in every single driver just in order to pass them into the allocate. Also iio_allocate_trigger_named -> iio_allocate_trigger as there is no unamed version any more, so that is now just confusing. Blackfin tested and fixed by Michael Hennerich. V2: Elements from Michael Hennerich's patches for the ade7758 Signed-off-by: Jonathan Cameron <jic23@cam.ac.uk> Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
* staging:iio:trigger sysfs userspace trigger rework.Jonathan Cameron2011-05-201-0/+13
| | | | | | | | | | | | | Awaiting comments on using the nested_irq_trick so that may change. Moves away from platform device to sysfs controlled creation and removal of these triggers. Fix double free of name on trigger allocation failure thanks to Michael Hennerich. Signed-off-by: Jonathan Cameron <jic23@cam.ac.uk> Reviewed-by: Michael Hennerich <michael.hennerich@analog.com> Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
* staging:iio:trigger remove legacy pollfunc elements.Jonathan Cameron2011-05-201-104/+20Star
| | | | | Signed-off-by: Jonathan Cameron <jic23@cam.ac.uk> Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
* staging:iio: add generic data ready poll function.Jonathan Cameron2011-05-201-0/+7
| | | | | | | | This case is extremely common, so let us only have the one copy. Signed-off-by: Jonathan Cameron <jic23@cam.ac.uk> Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
* staging:iio: Add infrastructure for irq_chip based triggersJonathan Cameron2011-05-201-30/+145
| | | | | | | | | | | | | | | | V3: Get rid of separate interrupt pool. This is well handled by irq_get_descs and irq_free_descs. Two functions I simply wasn't aware of previously. Thus the allocation for a given trigger is now handled by core code rather than us reinventing the wheel. V2: Stop silly name duplication. Move pool handling to industrialio-trigger as that is the only user. Changed over to using irq_modify_status rather than the arm specific set_irq_flags as per Thomas Gleixner's suggestion. Signed-off-by: Jonathan Cameron <jic23@cam.ac.uk> Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
* staging:iio: iio_trigger_unregister - remove rather strange search for what ↵Jonathan Cameron2011-04-261-7/+1Star
| | | | | | | we already have. Signed-off-by: Jonathan Cameron <jic23@cam.ac.uk> Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
* staging:iio:trigger remove export of iio_trigger_find_by_name, use ↵Jonathan Cameron2011-04-261-12/+7Star
| | | | | | | | | sysfs_streq for matching Trivial reorganization. Signed-off-by: Jonathan Cameron <jic23@cam.ac.uk> Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
* staging: iio: remove timestamp field from trigger and pass instead through ↵Jonathan Cameron2010-07-221-5/+5
| | | | | | | pollfuncs Signed-off-by: Jonathan Cameron <jic23@cam.ac.uk> Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
* staging: iio: Add iio_triggered_ring postenable and predisable + use in driversJonathan Cameron2010-07-221-0/+18
| | | | | | Signed-off-by: Jonathan Cameron <jic23@cam.ac.uk> Acked-by: Barry Song <21cnbao@gmail.com> Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
* staging: iio: Add and convert drivers to use iio_alloc_pollfuncJonathan Cameron2010-07-221-0/+13
| | | | | | Signed-off-by: Jonathan Cameron <jic23@cam.ac.uk> Acked-by: Barry Song <21cnbao@gmail.com> Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
* staging: iio: Use kasprintf to allocate and fill trig->nameJonathan Cameron2010-07-221-6/+3Star
| | | | | Signed-off-by: Jonathan Cameron <jic23@cam.ac.uk> Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
* staging:iio: Code cleanupsJonathan Cameron2010-07-081-2/+1Star
| | | | | Signed-off-by: Jonathan Cameron <jic23@cam.ac.uk> Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
* Staging: iio: industrialio-trigger.c: minor fixupsGreg Kroah-Hartman2010-05-111-6/+7
| | | | | | | | | | We needed to include a header file that declared the functions that are being exported in this file. Also fix up an indentation problem, and some sparse warnings. Cc: Jonathan Cameron <jic23@cam.ac.uk> Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
* Staging: iio: Trivial - remove pointless semi colon (checkpatch found)Jonathan Cameron2010-05-111-1/+1
| | | | | Signed-off-by: Jonathan Cameron <jic23@cam.ac.uk> Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
* staging: iio: Move from class to busJonathan Cameron2010-05-111-1/+1
| | | | | Signed-off-by: Jonathan Cameron <jic23@cam.ac.uk> Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
* Staging: iio: iio_trigger_find_by_name: Skip trailing newline if availableMichael Hennerich2010-05-111-0/+3
| | | | | | | | Skip trailing newline if available. Signed-off-by: Michael Hennerich <Michael.Hennerich@analog.com> Acked-by: Jonathan Cameron <jic23@cam.ac.uk> Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
* include cleanup: Update gfp.h and slab.h includes to prepare for breaking ↵Tejun Heo2010-03-301-0/+1
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | implicit slab.h inclusion from percpu.h percpu.h is included by sched.h and module.h and thus ends up being included when building most .c files. percpu.h includes slab.h which in turn includes gfp.h making everything defined by the two files universally available and complicating inclusion dependencies. percpu.h -> slab.h dependency is about to be removed. Prepare for this change by updating users of gfp and slab facilities include those headers directly instead of assuming availability. As this conversion needs to touch large number of source files, the following script is used as the basis of conversion. http://userweb.kernel.org/~tj/misc/slabh-sweep.py The script does the followings. * Scan files for gfp and slab usages and update includes such that only the necessary includes are there. ie. if only gfp is used, gfp.h, if slab is used, slab.h. * When the script inserts a new include, it looks at the include blocks and try to put the new include such that its order conforms to its surrounding. It's put in the include block which contains core kernel includes, in the same order that the rest are ordered - alphabetical, Christmas tree, rev-Xmas-tree or at the end if there doesn't seem to be any matching order. * If the script can't find a place to put a new include (mostly because the file doesn't have fitting include block), it prints out an error message indicating which .h file needs to be added to the file. The conversion was done in the following steps. 1. The initial automatic conversion of all .c files updated slightly over 4000 files, deleting around 700 includes and adding ~480 gfp.h and ~3000 slab.h inclusions. The script emitted errors for ~400 files. 2. Each error was manually checked. Some didn't need the inclusion, some needed manual addition while adding it to implementation .h or embedding .c file was more appropriate for others. This step added inclusions to around 150 files. 3. The script was run again and the output was compared to the edits from #2 to make sure no file was left behind. 4. Several build tests were done and a couple of problems were fixed. e.g. lib/decompress_*.c used malloc/free() wrappers around slab APIs requiring slab.h to be added manually. 5. The script was run on all .h files but without automatically editing them as sprinkling gfp.h and slab.h inclusions around .h files could easily lead to inclusion dependency hell. Most gfp.h inclusion directives were ignored as stuff from gfp.h was usually wildly available and often used in preprocessor macros. Each slab.h inclusion directive was examined and added manually as necessary. 6. percpu.h was updated not to include slab.h. 7. Build test were done on the following configurations and failures were fixed. CONFIG_GCOV_KERNEL was turned off for all tests (as my distributed build env didn't work with gcov compiles) and a few more options had to be turned off depending on archs to make things build (like ipr on powerpc/64 which failed due to missing writeq). * x86 and x86_64 UP and SMP allmodconfig and a custom test config. * powerpc and powerpc64 SMP allmodconfig * sparc and sparc64 SMP allmodconfig * ia64 SMP allmodconfig * s390 SMP allmodconfig * alpha SMP allmodconfig * um on x86_64 SMP allmodconfig 8. percpu.h modifications were reverted so that it could be applied as a separate patch and serve as bisection point. Given the fact that I had only a couple of failures from tests on step 6, I'm fairly confident about the coverage of this conversion patch. If there is a breakage, it's likely to be something in one of the arch headers which should be easily discoverable easily on most builds of the specific arch. Signed-off-by: Tejun Heo <tj@kernel.org> Guess-its-ok-by: Christoph Lameter <cl@linux-foundation.org> Cc: Ingo Molnar <mingo@redhat.com> Cc: Lee Schermerhorn <Lee.Schermerhorn@hp.com>
* Staging: IIO: Trigger support added to core.Jonathan Cameron2009-09-151-0/+399
Add general registration support for IIO triggers. These are currently only used to initialize a 'poll' of a given device. Examples include the lis3l02dq's data ready signal being used to initialize a read and gpio triggers being used to allow externally synchronized sensor reading. Each trigger can cause any number of 'consumer' devices to be polled with each storing data into a related ring buffer. Two stage triggering is supported with 'fast' and 'slow' paths. The first is used for things like pulling a data hold line high and the second for actual read which may take far longer. Changes since V2: * As with IIO triggers now use a registration approach much closer to that of input leading to cleaner code. Signed-off-by: Jonathan Cameron <jic23@cam.ac.uk> Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>