~ubuntu-branches/ubuntu/trusty/linux-linaro-omap/trusty

« back to all changes in this revision

Viewing changes to drivers/staging/iio/Documentation/device.txt

  • Committer: Package Import Robot
  • Author(s): John Rigby, John Rigby
  • Date: 2011-09-26 10:44:23 UTC
  • Revision ID: package-import@ubuntu.com-20110926104423-57i0gl3v99b3lkfg
Tags: 3.0.0-1007.9
[ John Rigby ]

Enable crypto modules and remove crypto-modules from
exclude-module files
LP: #826021

Show diffs side-by-side

added added

removed removed

Lines of Context:
8
8
 
9
9
First allocate one using:
10
10
 
11
 
struct iio_dev *indio_dev = iio_allocate_device();
 
11
struct iio_dev *indio_dev = iio_allocate_device(sizeof(struct chip_state));
 
12
where chip_state is a structure of local state data for this instance of
 
13
the chip.
 
14
 
 
15
That data can be accessed using iio_priv(struct iio_dev *)
12
16
 
13
17
Then fill in the following:
14
18
 
15
 
indio_dev->dev.parent
16
 
  the struct device associated with the underlying hardware.
17
 
 
18
 
indio_dev->num_interrupt_lines
19
 
   number of event triggering hardware lines the device has.
20
 
 
21
 
indio_dev->event_attrs
22
 
   attributes used to enable / disable hardware events - note the
23
 
   attributes are embedded in iio_event_attr structures with an
24
 
   associated iio_event_handler which may or may note be shared.
25
 
   If num_interrupt_lines = 0, then no need to fill this in.
26
 
 
27
 
indio_dev->attrs
28
 
   general attributes such as polled access to device channels.
29
 
 
30
 
indio_dev->dev_data
31
 
   private device specific data.
32
 
 
33
 
indio_dev->driver_module
34
 
   typically set to THIS_MODULE. Used to specify ownership of some
35
 
   iio created resources.
36
 
 
37
 
indio_dev->modes
38
 
   whether direct access and / or ring buffer access is supported.
 
19
- indio_dev->dev.parent
 
20
        Struct device associated with the underlying hardware.
 
21
- indio_dev->name
 
22
        Name of the device being driven - made available as the name
 
23
        attribute in sysfs.
 
24
 
 
25
- indio_dev->info
 
26
        pointer to a structure with elements that tend to be fixed for
 
27
        large sets of different parts supported by a given driver.
 
28
        This contains:
 
29
        * info->driver_module:
 
30
                Set to THIS_MODULE. Used to ensure correct ownership
 
31
                of various resources allocate by the core.
 
32
        * info->num_interrupt_lines:
 
33
                Number of event triggering hardware lines the device has.
 
34
        * info->event_attrs:
 
35
                Attributes used to enable / disable hardware events.
 
36
        * info->attrs:
 
37
                General device attributes. Typically used for the weird
 
38
                and the wonderful bits not covered by the channel specification.
 
39
        * info->read_raw:
 
40
                Raw data reading function. Used for both raw channel access
 
41
                and for associate parameters such as offsets and scales.
 
42
        * info->write_raw:
 
43
                Raw value writing function. Used for writable device values such
 
44
                as DAC values and caliboffset.
 
45
        * info->read_event_config:
 
46
                Typically only set if there are some interrupt lines.  This
 
47
                is used to read if an on sensor event detector is enabled.
 
48
        * info->write_event_config:
 
49
                Enable / disable an on sensor event detector.
 
50
        * info->read_event_value:
 
51
                Read value associated with on sensor event detectors. Note that
 
52
                the meaning of the returned value is dependent on the event
 
53
                type.
 
54
        * info->write_event_value:
 
55
                Write the value associated with on sensor event detectors. E.g.
 
56
                a threshold above which an interrupt occurs.  Note that the
 
57
                meaning of the value to be set is event type dependant.
 
58
 
 
59
- indio_dev->modes:
 
60
        Specify whether direct access and / or ring buffer access is supported.
 
61
- indio_dev->ring:
 
62
        An optional associated buffer.
 
63
- indio_dev->pollfunc:
 
64
        Poll function related elements. This controls what occurs when a trigger
 
65
        to which this device is attached sends and event.
 
66
- indio_dev->channels:
 
67
        Specification of device channels. Most attributes etc are built
 
68
        form this spec.
 
69
- indio_dev->num_channels:
 
70
        How many channels are there?
39
71
 
40
72
Once these are set up, a call to iio_device_register(indio_dev),
41
73
will register the device with the iio core.