Linux Kernel
3.7.1
Main Page
Related Pages
Modules
Namespaces
Data Structures
Files
File List
Globals
All
Data Structures
Namespaces
Files
Functions
Variables
Typedefs
Enumerations
Enumerator
Macros
Groups
Pages
drivers
staging
iio
accel
adis16204_trigger.c
Go to the documentation of this file.
1
#include <
linux/interrupt.h
>
2
#include <linux/kernel.h>
3
#include <
linux/spi/spi.h
>
4
#include <linux/export.h>
5
6
#include <
linux/iio/iio.h
>
7
#include <
linux/iio/trigger.h
>
8
#include "
adis16204.h
"
9
13
static
int
adis16204_data_rdy_trigger_set_state(
struct
iio_trigger
*trig,
14
bool
state
)
15
{
16
struct
iio_dev
*indio_dev = trig->
private_data
;
17
18
dev_dbg
(&indio_dev->
dev
,
"%s (%d)\n"
, __func__, state);
19
return
adis16204_set_irq
(indio_dev, state);
20
}
21
22
static
const
struct
iio_trigger_ops
adis16204_trigger_ops = {
23
.owner =
THIS_MODULE
,
24
.set_trigger_state = &adis16204_data_rdy_trigger_set_state,
25
};
26
27
int
adis16204_probe_trigger
(
struct
iio_dev
*indio_dev)
28
{
29
int
ret
;
30
struct
adis16204_state
*
st
= iio_priv(indio_dev);
31
32
st->
trig
=
iio_trigger_alloc
(
"adis16204-dev%d"
, indio_dev->
id
);
33
if
(st->
trig
==
NULL
) {
34
ret = -
ENOMEM
;
35
goto
error_ret;
36
}
37
38
ret =
request_irq
(st->
us
->irq,
39
&
iio_trigger_generic_data_rdy_poll
,
40
IRQF_TRIGGER_RISING
,
41
"adis16204"
,
42
st->
trig
);
43
if
(ret)
44
goto
error_free_trig;
45
46
st->
trig
->dev.parent = &st->
us
->dev;
47
st->
trig
->ops = &adis16204_trigger_ops;
48
st->
trig
->private_data = indio_dev;
49
ret =
iio_trigger_register
(st->
trig
);
50
51
/* select default trigger */
52
indio_dev->
trig
= st->
trig
;
53
if
(ret)
54
goto
error_free_irq;
55
56
return
0;
57
58
error_free_irq:
59
free_irq
(st->
us
->irq, st->
trig
);
60
error_free_trig:
61
iio_trigger_free
(st->
trig
);
62
error_ret:
63
return
ret
;
64
}
65
66
void
adis16204_remove_trigger
(
struct
iio_dev
*indio_dev)
67
{
68
struct
adis16204_state
*
state
= iio_priv(indio_dev);
69
70
iio_trigger_unregister
(state->
trig
);
71
free_irq
(state->
us
->irq, state->
trig
);
72
iio_trigger_free
(state->
trig
);
73
}
Generated on Thu Jan 10 2013 14:28:32 for Linux Kernel by
1.8.2