Skip to content

Commit

Permalink
---
Browse files Browse the repository at this point in the history
yaml
---
r: 162476
b: refs/heads/master
c: 847ec80
h: refs/heads/master
v: v3
  • Loading branch information
Jonathan Cameron authored and Greg Kroah-Hartman committed Sep 15, 2009
1 parent fdbd831 commit 583c88c
Show file tree
Hide file tree
Showing 10 changed files with 1,720 additions and 1 deletion.
2 changes: 1 addition & 1 deletion [refs]
Original file line number Diff line number Diff line change
@@ -1,2 +1,2 @@
---
refs/heads/master: a5ca2dfc4ebd33e18f981f562833c39efdc2585c
refs/heads/master: 847ec80bbaa76aae41062d6802cea9c1b2289f14
2 changes: 2 additions & 0 deletions trunk/drivers/staging/Kconfig
Original file line number Diff line number Diff line change
Expand Up @@ -137,5 +137,7 @@ source "drivers/staging/rar/Kconfig"

source "drivers/staging/sep/Kconfig"

source "drivers/staging/iio/Kconfig"

endif # !STAGING_EXCLUDE_BUILD
endif # STAGING
1 change: 1 addition & 0 deletions trunk/drivers/staging/Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -50,3 +50,4 @@ obj-$(CONFIG_HYPERV) += hv/
obj-$(CONFIG_VME_BUS) += vme/
obj-$(CONFIG_RAR_REGISTER) += rar/
obj-$(CONFIG_DX_SEP) += sep/
obj-$(CONFIG_IIO) += iio/
11 changes: 11 additions & 0 deletions trunk/drivers/staging/iio/Kconfig
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
#
# Industrial I/O subsytem configuration
#

menuconfig IIO
tristate "Industrial I/O support"
---help---
The industrial I/O subsystem provides a unified framework for
drivers for many different types of embedded sensors using a
number of different physical interfaces (i2c, spi etc). See
Documentation/industrialio for more information.
6 changes: 6 additions & 0 deletions trunk/drivers/staging/iio/Makefile
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
#
# Makefile for the industrial I/O core.
#

obj-$(CONFIG_IIO) += industrialio.o
industrialio-y := industrialio-core.o
118 changes: 118 additions & 0 deletions trunk/drivers/staging/iio/chrdev.h
Original file line number Diff line number Diff line change
@@ -0,0 +1,118 @@
/* The industrial I/O core - character device related
*
* Copyright (c) 2008 Jonathan Cameron
*
* This program is free software; you can redistribute it and/or modify it
* under the terms of the GNU General Public License version 2 as published by
* the Free Software Foundation.
*/

#ifndef _IIO_CHRDEV_H_
#define _IIO_CHRDEV_H_
struct iio_dev;

/**
* struct iio_handler - Structure used to specify file operations
* for a particular chrdev
* @chrdev: character device structure
* @id: the location in the handler table - used for deallocation.
* @flags: file operations related flags including busy flag.
* @private: handler specific data used by the fileops registered with
* the chrdev.
*/
struct iio_handler {
struct cdev chrdev;
int id;
unsigned long flags;
void *private;
};

#define iio_cdev_to_handler(cd) \
container_of(cd, struct iio_handler, chrdev)

/**
* struct iio_event_data - The actual event being pushed to userspace
* @id: event identifier
* @timestamp: best estimate of time of event occurance (often from
* the interrupt handler)
*/
struct iio_event_data {
int id;
s64 timestamp;
};

/**
* struct iio_detected_event_list - list element for events that have occured
* @list: linked list header
* @ev: the event itself
* @shared_pointer: used when the event is shared - i.e. can be escallated
* on demand (eg ring buffer 50%->100% full)
*/
struct iio_detected_event_list {
struct list_head list;
struct iio_event_data ev;
struct iio_shared_ev_pointer *shared_pointer;
};
/**
* struct iio_shared_ev_pointer - allows shared events to identify if currently
* in the detected event list
* @ev_p: pointer to detected event list element (null if not in list)
* @lock: protect this element to prevent simultaneous edit and remove
*/
struct iio_shared_ev_pointer {
struct iio_detected_event_list *ev_p;
spinlock_t lock;
};

/**
* struct iio_event_interface - chrdev interface for an event line
* @dev: device assocated with event interface
* @handler: fileoperations and related control for the chrdev
* @wait: wait queue to allow blocking reads of events
* @event_list_lock: mutex to protect the list of detected events
* @det_events: list of detected events
* @max_events: maximum number of events before new ones are dropped
* @current_events: number of events in detected list
* @id: indentifier to allow the event interface to know which
* physical line it corresponds to
* @owner: ensure the driver module owns the file, not iio
* @private: driver specific data
* @_name: used internally to store the sysfs name for minor id
* attribute
*/
struct iio_event_interface {
struct device dev;
struct iio_handler handler;
wait_queue_head_t wait;
struct mutex event_list_lock;
struct iio_detected_event_list det_events;
int max_events;
int current_events;
int id;
struct iio_chrdev_minor_attr attr;
struct module *owner;
void *private;
char _name[20];
char _attrname[20];
};

/**
* struct iio_event_handler_list - element in list of handlers for events
* @list: list header
* @refcount: as the handler may be shared between multiple device
* side events, reference counting ensures clean removal
* @exist_lock: prevents race conditions related to refcount useage.
* @handler: event handler function - called on event if this
* event_handler is enabled.
*
* Each device has one list of these per interrupt line
**/
struct iio_event_handler_list {
struct list_head list;
int refcount;
struct mutex exist_lock;
int (*handler)(struct iio_dev *dev_info, int index, s64 timestamp,
int no_test);
};

#endif
Loading

0 comments on commit 583c88c

Please sign in to comment.