Linux Kernel  3.7.1
 All Data Structures Namespaces Files Functions Variables Typedefs Enumerations Enumerator Macros Groups Pages
Functions
iio_simple_dummy_events.c File Reference
#include <linux/kernel.h>
#include <linux/slab.h>
#include <linux/interrupt.h>
#include <linux/irq.h>
#include <linux/iio/iio.h>
#include <linux/iio/sysfs.h>
#include <linux/iio/events.h>
#include "iio_simple_dummy.h"
#include "iio_dummy_evgen.h"

Go to the source code of this file.

Functions

int iio_simple_dummy_read_event_config (struct iio_dev *indio_dev, u64 event_code)
 
int iio_simple_dummy_write_event_config (struct iio_dev *indio_dev, u64 event_code, int state)
 
int iio_simple_dummy_read_event_value (struct iio_dev *indio_dev, u64 event_code, int *val)
 
int iio_simple_dummy_write_event_value (struct iio_dev *indio_dev, u64 event_code, int val)
 
int iio_simple_dummy_events_register (struct iio_dev *indio_dev)
 
int iio_simple_dummy_events_unregister (struct iio_dev *indio_dev)
 

Function Documentation

int iio_simple_dummy_events_register ( struct iio_dev indio_dev)

iio_simple_dummy_events_register() - setup interrupt handling for events : device instance data

This function requests the threaded interrupt to handle the events. Normally the irq is a hardware interrupt and the number comes from board configuration files. Here we get it from a companion module that fakes the interrupt for us. Note that module in no way forms part of this example. Just assume that events magically appear via the provided interrupt.

Definition at line 151 of file iio_simple_dummy_events.c.

int iio_simple_dummy_events_unregister ( struct iio_dev indio_dev)

iio_simple_dummy_events_unregister() - tidy up interrupt handling on remove : device instance data

Definition at line 182 of file iio_simple_dummy_events.c.

int iio_simple_dummy_read_event_config ( struct iio_dev indio_dev,
u64  event_code 
)

Copyright (c) 2011 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.

Event handling elements of industrial I/O reference driver. iio_simple_dummy_read_event_config() - is event enabled? : the device instance data : event code of the event being queried

This function would normally query the relevant registers or a cache to discover if the event generation is enabled on the device.

Definition at line 31 of file iio_simple_dummy_events.c.

int iio_simple_dummy_read_event_value ( struct iio_dev indio_dev,
u64  event_code,
int val 
)

iio_simple_dummy_read_event_value() - get value associated with event : device instance specific data : event code for the event whose value is being queried : value for the event code.

Many devices provide a large set of events of which only a subset may be enabled at a time, with value registers whose meaning changes depending on the event enabled. This often means that the driver must cache the values associated with each possible events so that the right value is in place when the enabled event is changed.

Definition at line 91 of file iio_simple_dummy_events.c.

int iio_simple_dummy_write_event_config ( struct iio_dev indio_dev,
u64  event_code,
int  state 
)

iio_simple_dummy_write_event_config() - set whether event is enabled : the device instance data : event code of event being enabled/disabled : whether to enable or disable the device.

This function would normally set the relevant registers on the devices so that it generates the specified event. Here it just sets up a cached value.

Definition at line 49 of file iio_simple_dummy_events.c.

int iio_simple_dummy_write_event_value ( struct iio_dev indio_dev,
u64  event_code,
int  val 
)

iio_simple_dummy_write_event_value() - set value associate with event : device instance specific data : event code for the event whose value is being set : the value to be set.

Definition at line 108 of file iio_simple_dummy_events.c.